$ cnpm install color-parse
Fast and compact color string parser.
$ npm install color-parse
var parse = require('color-parse')
parse('hsla(12 10% 50% / .3)')
// { space: 'hsl', values: [12, 10, 50], alpha: 0.3 }
red
, green
etc., see color-name#RGB[A]
#RRGGBB[AA]
rgb[a](R, G, B[, A])
rgb[a](R G B[ / A])
hsl[a](H, S, L[, A])
, inc. named hueshsl[a](H S L [ / A])
hwb(H, W, B)
cmyk(C, M, Y, K)
xyz(X, Y, Z)
lab(L, A, B)
lch(L, C, H)
luv(L, U, V)
R:10 G:20 B:30
(R10 / G20 / B30)
C100/M80/Y0/K35
[10, 20, 20]
as RGB color space{r: 10, g: 20, b: 30}
{red: 10, green: 20, blue: 30}
{h: 10, s: 20, l: 30}
0x00ff00
, 0x0000ff
numbers'yellowblue'
returns null
Copyright 2013 - present © cnpmjs.org