Package Exports
- color-space
- color-space/cmyk
- color-space/hsl
- color-space/hsv
- color-space/lab
- color-space/rgb
- color-space/xyz
- color-space/yuv
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (color-space) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
color-space 
Math and data behind color spaces and color conversions. Converter & tests.
Use
$ npm install color-space
To include all spaces:
var spaces = require('color-space');
//convert lab to lch
spaces.lab.lch([80,50,60]);
To include one target space:
var rgb = require('color-space/rgb');
var hsl = require('color-space/hsl');
//convert rgb to lch
hsl.lch([200,230,100]);
Use browserify to use in a browser.
API
Convert from one space to another:
var fromSpace = 'rgb', toSpace = 'hsl';
spaces[fromSpace][toSpace](array);
Get space data:
space.name //space name
space.min //channel minimums
space.max //channel maximums
space.channel //channel names
space.alias //alias space names, if any
space.illuminant //space-specific properties
Available spaces:
- rgb
- hsl
- hsv (hsb)
- hwb
- cmyk
- xyz (ciexyz)
- lab (cielab)
- luv (cieluv)
- lch (cielch)
To see details console.log(space)
.
Contribute
Please fork, add space/convertions. If you add a space, make sure you have implemented at least to/from XYZ or to/from RGB conversions. Don’t forget to add a test-case.
This is meant to be a basic library that can be used by other libraries to wrap color calculations in some cool way.