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)
<values>
is an array or an object from css-parse
<type>
is an optional string:
-
'hex'
—#RRGGBB
or#RGB
if possible. -
'keyword'
—red
, see the list of supported names. -
'percent'
—rgb(10%, 20%, 30%, 0.1)
. -
'adobe1'
—R:0, G:0, B:0
. -
'adobe2'
—(R0 / G0 / B0)
. -
'websafe'
— request feature. -
'pantone'
— request feature. -
undefined
—rgba(10, 20, 30, 0.2)
. - Any other string —
<type>(<value1>, <value2>, <value3>, ...)
.