Package Exports
- color-space
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.
Use
$ npm install color-space
Use browserify for browser use.
var convert = require('color-space');
//convert rgb to lch
convert.rgb.lch([200,230,100]);
API
Convert from one space to another:
var fromSpace = 'rgb', toSpace = 'hsl';
convert[fromSpace][toSpace](array);
Get space data:
convert[space].min //channel minimums
convert[space].max //channel maximums
convert[space].channel //channel names
convert[space].alias //alias space names, if any
Available spaces:
- rgb
- hsl
- hsv (hsb)
- hwb
- cmyk
- xyz (ciexyz)
- lab (cielab)
- lch (cielch)
To see details console.log(convert)
.
Color-convert differences
Color-space was initially a fork of color-convert, but then it was separated into a standalone module with changes:
- No keyword "space": actually, it is not a space, it is a different kind of knowledge. Also extra bytes are saved.
- No wrapper code: you have a natural wrapper already — harthur/color or a faster fork dfcreative/color.
conversions.js
are placed to index.js for better use.- [pending] CIE spaces.
- [pending] HUSL spaces (great thanks to Alexei Boronine for his HUSL).
- Minimums, maximums, channel names and aliases info.
- Better structured, easier exported (esp. for webworkers).
- No result rounding — she can always do it herself.
- Unlicensed.
Contribute
Please fork, add conversions, figure out color profile stuff for XYZ, LAB, etc. This is meant to be a basic library that can be used by other libraries to wrap color calculations in some cool way.