JSPM

  • Created
  • Published
  • Downloads 426326
  • Score
    100M100P100Q230234F

Math & data behind color spaces and color conversions.

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 Build Status

Math and data behind color spaces and color conversions. Converter & tests.

NPM

Use

$ npm install color-space

Use browserify to use in browser.

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)
  • luv (cieluv)
  • lch (cielch)

To see details console.log(convert).

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.