@@ -4,19 +4,19 @@ Color-convert is a color conversion library for JavaScript and node.
44It converts all ways between ` rgb ` , ` hsl ` , ` hsv ` , ` hwb ` , ` cmyk ` , ` ansi ` , ` ansi16 ` , ` hex ` strings, and CSS ` keyword ` s (will round to closest):
55
66``` js
7- var convert = require ( ' color-convert' ) ;
7+ import convert from ' color-convert' ;
88
99convert .rgb .hsl (140 , 200 , 100 ); // [96, 48, 59]
1010convert .keyword .rgb (' blue' ); // [0, 0, 255]
1111
12- var rgbChannels = convert .rgb .channels ; // 3
13- var cmykChannels = convert .cmyk .channels ; // 4
14- var ansiChannels = convert .ansi16 .channels ; // 1
12+ const rgbChannels = convert .rgb .channels ; // 3
13+ const cmykChannels = convert .cmyk .channels ; // 4
14+ const ansiChannels = convert .ansi16 .channels ; // 1
1515```
1616
1717# Install
1818
19- ``` console
19+ ``` sh
2020$ npm install color-convert
2121```
2222
@@ -29,7 +29,7 @@ All functions have a rounded and unrounded variant. By default, return values ar
2929All 'from' functions have a hidden property called ` .channels ` that indicates the number of channels the function expects (not including alpha).
3030
3131``` js
32- var convert = require ( ' color-convert' ) ;
32+ import convert from ' color-convert' ;
3333
3434// Hex to LAB
3535convert .hex .lab (' DEADBF' ); // [ 76, 21, -2 ]
@@ -46,7 +46,7 @@ All functions that accept multiple arguments also support passing an array.
4646Note that this does ** not** apply to functions that convert from a color that only requires one value (e.g. ` keyword ` , ` ansi256 ` , ` hex ` , etc.)
4747
4848``` js
49- var convert = require ( ' color-convert' ) ;
49+ import convert from ' color-convert' ;
5050
5151convert .rgb .hex (123 , 45 , 67 ); // '7B2D43'
5252convert .rgb .hex ([123 , 45 , 67 ]); // '7B2D43'
0 commit comments