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

Package detail

color-space

colorjs1.8mUnlicense2.3.2TypeScript support: included

Collection of color space conversions

color, colour, color-space, gamut, color-convert, color-conversion, color-conversions, color-translation, color-math, color-data, rgb, xyz, hsl, hsv, hsi, hwb, cmyk, cmy, xyy, yiq, yuv, ydbdr, ycgco, ypbpr, ycbcr, xvycc, yccbccrc, ucs, uvw, jpeg, lab, labh, lms, lchab, luv, lchuv, hsluv, hpluv, cubehelix, coloroid, hcg, hcy, tsl, yes, osaucs, hsp, hsm, lrgb, oklab

readme

Color-space test stable npm size

Open collection of color spaces.

Demo.

Usage

import space from 'color-space';

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

Spaces can be imported separately:

import rgb from 'color-space/rgb.js';
import hsl from 'color-space/hsl.js';

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

API

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

Spaces

  • <input checked="" disabled="" type="checkbox"> RGB — sRGB
  • <input checked="" disabled="" type="checkbox"> LRGB – linear light sRGB
  • <input checked="" disabled="" type="checkbox"> HSL — cylindrical-coordinates sRGB
  • <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"> LABH
  • <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 checked="" disabled="" type="checkbox"> OKLAB
  • <input disabled="" type="checkbox"> Munsell
  • <input disabled="" type="checkbox"> NCS
  • <input disabled="" type="checkbox"> PMS
  • <input disabled="" type="checkbox"> RAL
  • <input checked="" disabled="" type="checkbox"> TSL – color space designed for face detection purpose.
  • <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 checked="" disabled="" type="checkbox"> HSM

Purpose

A complete collection of color spaces with minimal consistent and clean API, verified formulas and cases. While alternatives focus on digital color spaces, this project takes broader perspective, including historical / multidisciplinary spaces. A side effect is verifying and correcting papers.

Credits

Thanks to all who contribute to color science – researchers, scientists, color theorists, specifiers, implementors, developers, and users.

Similar

culori, colorjs.io, color-api, texel/color,

🕉