node package manager
Stop writing boring code. Discover, share, and reuse within your team. Create a free org »

color-system

Build Status

color-system

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

usage

in node.js

npm install color-system

in browsers

wget https://raw.github.com/tmcw/color-system/master/colorsystem.js

api

hsv(rgb) -> hsv
hsv.invert(hsv) -> rgb
 
hsl(rgb) -> hsl
hsl.invert(hsl) -> rgb
 
hue(rgb) -> hue
saturation(rgb) -> saturation
lightness(rgb) -> lightness

example

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] 

development

build docs & standalone for browsers:

npm run-script make

see also

'full solutions'

'modules'

why

'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