color-stringify
v1.2.1
Published
Build up a css string from color values
Downloads
106,837
Readme
color-stringify
Stringify passed values into a color string.
$ npm install color-stringify
var stringify = require('color-stringify');
stringify([120,100,100,.4], 'hsl'); //hsla(120, 100%, 100%, .4)
API
stringify(<values>, <type>?)
<values>
is an array or an object from css-parse
<type>
is an optional string:
- [x]
'hex'
—#RRGGBB
or#RGB
if possible. - [x]
'keyword'
—red
, see the list of supported names. - [x]
'percent'
—rgb(10%, 20%, 30%, 0.1)
. - [x]
'adobe1'
—R:0, G:0, B:0
. - [x]
'adobe2'
—(R0 / G0 / B0)
. - [ ]
'websafe'
— request feature. - [ ]
'pantone'
— request feature. - [x]
undefined
—rgba(10, 20, 30, 0.2)
. - [x] Any other string —
<type>(<value1>, <value2>, <value3>, ...)
.