Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@grewer/color-space

colorjs57MIT1.16.0

Color space conversions and data

color, colour, rgb, hsl, hsv, lab, lch, luv, lch, cie, hsluv, husl, color-convert, gamut, color-conversions, color-space, color-translation, color-data, coloroid, cubehelix, munsell, hcg, hsp

readme

fixed:

  • rgb.yuv error

Color-space Build Status stable OpenCollective OpenCollective

Conversions and data for color spaces. Demo.

Usage

npm install color-space

var space = require('color-space');

//convert lab to lch
var result = space.lab.lch([80,50,60]);

You can require a separate space to reduce size significantly:

var rgb = require('color-space/rgb');
var hsl = require('color-space/hsl');

//convert rgb to hsl
rgb.hsl([200,230,100]);

API

<fromSpace>.<toSpace>(array);
<space>.name //space name
<space>.min //channel minimums
<space>.max //channel maximums
<space>.channel //channel names
<space>.alias //alias space names

Spaces

  • <input checked="" disabled="" type="checkbox"> RGB — additive color model based on red, green and blue primary colors.
  • <input checked="" disabled="" type="checkbox"> HSL — cylindrical-coordinates representation of RGB.
  • <input checked="" disabled="" type="checkbox"> HSV, HSB
  • <input checked="" disabled="" type="checkbox"> HWB
  • <input checked="" disabled="" type="checkbox"> HSI — used for computer vision due to better separation of shapes in an image, comparing to HSL/HSB.
  • <input checked="" disabled="" type="checkbox"> CMYK
  • <input checked="" disabled="" type="checkbox"> CMY
  • <input checked="" disabled="" type="checkbox"> XYZ
  • <input checked="" disabled="" type="checkbox"> XYY (YXY)
  • <input checked="" disabled="" type="checkbox"> LAB
  • <input checked="" disabled="" type="checkbox"> LCHab
  • <input checked="" disabled="" type="checkbox"> LUV
  • <input checked="" disabled="" type="checkbox"> LCHuv
  • <input checked="" disabled="" type="checkbox"> HSLuv
  • <input checked="" disabled="" type="checkbox"> HPLuv
  • <input checked="" disabled="" type="checkbox"> LABHunter
  • <input checked="" disabled="" type="checkbox"> YUV
  • <input checked="" disabled="" type="checkbox"> YIQ
  • <input checked="" disabled="" type="checkbox"> YCgCo
  • <input checked="" disabled="" type="checkbox"> YDbDr
  • <input checked="" disabled="" type="checkbox"> YPbPr
  • <input checked="" disabled="" type="checkbox"> YCbCr
  • <input checked="" disabled="" type="checkbox"> YcCbcCrc
  • <input checked="" disabled="" type="checkbox"> JPEG
  • <input checked="" disabled="" type="checkbox"> XvYCC
  • <input checked="" disabled="" type="checkbox"> UCS
  • <input checked="" disabled="" type="checkbox"> UVW
  • <input disabled="" type="checkbox"> Munsell
  • <input disabled="" type="checkbox"> NCS
  • <input disabled="" type="checkbox"> PMS
  • <input disabled="" type="checkbox"> RAL
  • <input disabled="" type="checkbox"> TSL
  • <input disabled="" type="checkbox"> RG
  • <input disabled="" type="checkbox"> RGK
  • <input checked="" disabled="" type="checkbox"> Coloroid — color space for architects and visual constructors, Hungarian Standard MSZ 7300 since 2000.
  • <input disabled="" type="checkbox"> OSA-UCS — accurately reprsenting uniform color differences, developed by the Optical Society of America’s Committee on Uniform Color Scales.
  • <input disabled="" type="checkbox"> HKS
  • <input checked="" disabled="" type="checkbox"> LMS — represents sensitivity of the human eye to Long, Medium and Short wavelengths.
  • <input checked="" disabled="" type="checkbox"> Cubehelix — colormaps for data visualization.
  • <input disabled="" type="checkbox"> Gray
  • <input disabled="" type="checkbox"> CIECAM02
  • <input disabled="" type="checkbox"> US Federal Standard 595
  • <input disabled="" type="checkbox"> Toyo
  • <input disabled="" type="checkbox"> PhotoYCC
  • <input checked="" disabled="" type="checkbox"> HCG
  • <input disabled="" type="checkbox"> HCL
  • <input checked="" disabled="" type="checkbox"> HSP
  • <input disabled="" type="checkbox"> HCY
  • <input checked="" disabled="" type="checkbox"> YES — computationally effective color space for face recognition.
  • <input disabled="" type="checkbox"> British Standard Colour
  • <input disabled="" type="checkbox"> RG chromacity
  • <input disabled="" type="checkbox"> CIE DSH
  • <input disabled="" type="checkbox"> HSM

Contribute

Please fork, add color space with basic conversions to/from XYZ or RGB and tests. The goal of project is to provide the most complete set of color spaces with maximally minimal uniform API.

Credits

Thanks to all the color scientists, who devoted their lives to color research and delivered their knowledge to us, for now we can trust them and use their formulas and their code.

Backers

Support us with a monthly donation and help us continue our activities. [Become a backer]

Sponsors

Become a sponsor and get your logo on our README on Github with a link to your site. [Become a sponsor]

  • colormap — collection of colormaps to map colors of images/data. A replacement for visualising spaces like cubehelix.
  • color-spectrum — convert spectrum to a color.
  • color-interpolate — interpolate between color values.
  • color-tool — color picker based on color-space.

Similar projects