svelte-color-input
v0.0.4
Published
A versatile color input component for Svelte applications that works across browsers, includes preset swatches, and plans to support eye-dropper functionality and user-defined persistent swatches in the future.
Downloads
14
Readme
svelte-color-input
A versatile color input component for Svelte applications that works across browsers, includes preset swatches, and plans to support eye-dropper functionality and user-defined persistent swatches in the future.
Installation
To install the svelte-color-input
package, run the following command in your project directory:
npm install svelte-color-input
Usage
After installation, you can use the ColorInput
component in your Svelte files:
- Import the component in your Svelte file:
<script lang="ts">
import { ColorInput } from 'svelte-color-input';
</script>
- Use the component in your template:
<ColorInput value="#bad424" />
Props
value
(string): The initial color value in hexadecimal format.
Features
- Cross-browser compatibility
- Preset color swatches
- Planned features:
- Eye-dropper functionality
- User-defined swatches that persist across browser refreshes
Demo
You can see the svelte-color-input
in action in the Bezier Typeface Specimen Builder:
This application uses our color input component to allow users to select colors for their typeface specimens. It's a great example of how the svelte-color-input
can be integrated into a real-world application.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT License
Copyright (c) 2024 Wenting Zhang of https://typogram.co
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.