transfer colors between color systems


Convert and compute in color systems (RGB, HSV, HSL, LAB, XYZ, LCH)

in node.js

npm install color-system

in browsers

hsv(rgb) -> hsv
hsv.invert(hsv) -> rgb
hsl(rgb) -> hsl
hsl.invert(hsl) -> rgb
hue(rgb) -> hue
saturation(rgb) -> saturation
lightness(rgb) -> lightness
var colorsys = require('color-system');
colorsys.hsl([0, 0, 0]); // [r, g, b] => [h, s, l] 
colorsys.hsv([0, 0, 0]); // [r, g, b] => [h, s, v] 

build docs & standalone for browsers:

npm run-script make

'full solutions'


'Why write yet another JavaScript color library?'

  • This is written in vanilla, idiomatic JavaScript
  • It aims to be literate like simple-statistics and to remove and explain the 'magic numbers' that rule color math
  • This aims to do just color systems - other concerns in other modules