jscolor
Super simple color manipulation using getters and setters
Install:
npm install --save jscolor
Usage:
let c = '#483d8b'
Read color values without any extra work:
cr // => 72cg // => 61cb // => 139ca // => 1cred // => 72cgreen // => 61cblue // => 139calpha // => 1crgb // => 'rgb(72,61,139)'crgba // => 'rgba(72,61,139,1)'ch // => 248cs // => 39cl // => 39chue // => 248csaturation // => 39clightness // => 39chsl // => hsl(248,39%,39%)chsla // => hsla(248,39%,39%,1)chex // => '#483d8b'cyiq // => 73.181cname // => 'darkslateblue'
Manipulate colors using normal operators:
cr = 100crgb // => 'rgb(100,61,139)'chex // => '#643d8b' chue += 180crgb // => 'rgb(129,139,61)'chex // => '#648b3d' crgb = 'rgb(150,170,180)'chsl // => 'hsl(200,17%,65%)'chex // => '#96aab4'