pick-color

1.1.2 • Public • Published

A JSON with color names, some facilities and its values ( decimal and hex ). Based on http://dev.w3.org/csswg/css-color/#named-colors.

npm install pick-color

let PickColor = require('pick-color');
 
let pickColor = new PickColor();
 
// Get the decimal code of color
pickColor.getDecimal('yellow'); // [255, 255 , 0]
 
 
// Get the hex code of color
pickColor.getHex('yellow'); // #FFFF00
 
// Change the color to whatever you want
 
// It means yellow color at position 0 should be 1
pickColor.editColor( 'yellow', 0, 1 ); // #FFFF01
 
// Another example
pickColor.editColor( 'yellow', 3, 'A' ); // #FFAF00
 
// Also it returns decimal code after edition
pickColor.editColor( 'yellow', 0, 1, 'dec' ); // [255, 255 , 1]
 
// Another example
pickColor.editColor( 'yellow', 3, 'A', 'dec' ); // [255, 175 , 0]

Package Sidebar

Install

npm i pick-color

Weekly Downloads

0

Version

1.1.2

License

MIT

Unpacked Size

14.4 kB

Total Files

4

Last publish

Collaborators

  • faramj