Open collection of color spaces.
Demo.
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]);
<fromSpace>.<toSpace>(array);
<space>.name //space name
<space>.channel //channel names
<space>.min //channel minimums
<space>.max //channel maximums
- [x] RGB — sRGB
- [x] LRGB – linear light sRGB
- [x] HSL — cylindrical-coordinates sRGB
- [x] HSV, HSB
- [x] HWB
- [x] HSI — used for computer vision due to better separation of shapes in an image, comparing to HSL/HSB.
- [x] CMYK
- [x] CMY
- [x] XYZ
- [x] XYY (YXY)
- [x] LAB
- [x] LCHab
- [x] LUV
- [x] LCHuv
- [x] HSLuv
- [x] HPLuv
- [x] LABH
- [x] YUV
- [x] YIQ
- [x] YCgCo
- [x] YDbDr
- [x] YPbPr
- [x] YCbCr
- [x] YcCbcCrc
- [x] JPEG
- [x] XvYCC
- [x] UCS
- [x] UVW
- [x] OKLAB
- [ ] Munsell
- [ ] NCS
- [ ] PMS
- [ ] RAL
- [x] TSL – color space designed for face detection purpose.
- [ ] RG
- [ ] RGK
- [x] Coloroid — color space for architects and visual constructors, Hungarian Standard MSZ 7300 since 2000.
- [ ] OSA-UCS — accurately reprsenting uniform color differences, developed by the Optical Society of America’s Committee on Uniform Color Scales.
- [ ] HKS
- [x] LMS — represents sensitivity of the human eye to Long, Medium and Short wavelengths.
- [x] Cubehelix — colormaps for data visualization.
- [ ] Gray
- [ ] CIECAM02
- [ ] US Federal Standard 595
- [ ] Toyo
- [ ] PhotoYCC
- [x] HCG
- [ ] HCL
- [x] HSP
- [ ] HCY
- [x] YES — computationally effective color space for face recognition.
- [ ] British Standard Colour
- [ ] RG chromacity
- [ ] CIE DSH
- [x] HSM
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.
Thanks to all who contribute to color science – researchers, scientists, color theorists, specifiers, implementors, developers, and users.