Colr Pickr, a vanilla JavaScript color picker component built with SVGs, with features like saving colors. Similar design to the chrome-dev-tools color picker.
npm install @r-tek/colr_pickr
Colr Pickr, a vanilla JavaScript color picking component built with SVGs, with features like saving colors. Similar design to the chrome-dev-tools color picker
shell
$ npm i @r-tek/colr_pickr
`
If you are using a bundler like Webpack, you can import the module:
`javascript
// ES6
import pickr from '@r-tek/colr_pickr';
// OR
// CommonJs
const pickr = require('@r-tek/colr_pickr');
`
For now, you'll need to bring in the CSS file through one of the methods below.
- Using the CDN via jsDelivr:
`html
type="text/javascript"
src="https://cdn.jsdelivr.net/npm/@r-tek/colr_pickr@2.0.0/build/colr_pickr.min.js"
>
`
`html
rel="stylesheet"
type="text/css"
href="https://cdn.jsdelivr.net/npm/@r-tek/colr_pickr@2.0.0/build/colr_pickr.min.css"
/>
`
- Alternatively, you could clone/download the repository. Under the /build directory, include the colr_pickr_min.js and the colr_pickr_min.css in your project.
###### Usage
`html
`
$3
For more details on functions shown in the example, and others, check out the API document on the project website:
https://r-tek.github.io/colr_pickr/documentation.html
$3
When you give the Color Picker a color value to read, it has to be a supported value format.
Colr Pickr support all the popular choices, the table below show all supported value formats:
| Format Name | Example Format |
| :---------- | :-------------------------- |
| hex | "#ff0000" |
| hexAlpha | "#ff0000ff" |
| rgb | "rgb(255, 0, 0)" |
| rgba | "rgb(255, 0, 0, 1)" |
| hsl | "hsl(360, 100%, 50%)" |
| hsla | "hsla(360, 100%, 50%, 1)"` |