https://github.com/colorjs/color-space
Math & data behind color spaces and color conversions.
https://github.com/colorjs/color-space
color colorjs
Last synced: 24 days ago
JSON representation
Math & data behind color spaces and color conversions.
- Host: GitHub
- URL: https://github.com/colorjs/color-space
- Owner: colorjs
- License: unlicense
- Created: 2014-11-23T13:39:15.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2024-02-13T10:03:32.000Z (about 1 year ago)
- Last Synced: 2024-05-02T00:03:50.629Z (12 months ago)
- Topics: color, colorjs
- Language: JavaScript
- Homepage: http://colorjs.github.io/color-space
- Size: 558 KB
- Stars: 318
- Watchers: 12
- Forks: 24
- Open Issues: 22
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- my-awesome-list - color-space
README
# Color-space [](https://github.com/colorjs/color-space/actions/workflows/test.yml) [](http://github.com/badges/stability-badges) [](https://npmjs.org/color-space) [](https://bundlephobia.com/package/color-space)
Open collection of color spaces.
[Demo](http://colorjs.github.io/color-space).
## Usage
```js
import space from 'color-space';//convert lab to lch
var result = space.lab.lch([80,50,60]);
```Spaces can be imported separately:
```js
import rgb from 'color-space/rgb.js';
import hsl from 'color-space/hsl.js';//convert rgb to hsl
rgb.hsl([200, 230, 100]);
```## API
```js
.(array);
.name //space name
.channel //channel names
.min //channel minimums
.max //channel maximums
```## Spaces
* [x] [RGB](https://en.wikipedia.org/wiki/CIE_1931_color_space#CIE_RGB_colour_space) — sRGB
* [x] [LRGB](https://en.wikipedia.org/wiki/SRGB#Transfer_function_("gamma")) – linear light sRGB
* [x] [HSL](https://en.wikipedia.org/wiki/HSL_and_HSV) — cylindrical-coordinates sRGB
* [x] [HSV, HSB](https://en.wikipedia.org/wiki/HSL_and_HSV)
* [x] [HWB](http://dev.w3.org/csswg/css-color/#the-hwb-notation)
* [x] [HSI](https://en.wikipedia.org/wiki/HSL_and_HSV) — used for computer vision due to better separation of shapes in an image, comparing to HSL/HSB.
* [x] [CMYK](https://en.wikipedia.org/wiki/CMYK_color_model)
* [x] [CMY](https://en.wikipedia.org/wiki/CMYK_color_model)
* [x] [XYZ](http://en.wikipedia.org/wiki/CIE_1931_color_space)
* [x] [XYY (YXY)](https://en.wikipedia.org/wiki/CIE_1931_color_space#CIE_xy_chromaticity_diagram_and_the_CIE_xyY_color_space)
* [x] [LAB](http://en.wikipedia.org/wiki/Lab_color_space)
* [x] [LCHab](https://en.wikipedia.org/wiki/Lab_color_space#Cylindrical_representation:_CIELCh_or_CIEHLC)
* [x] [LUV](http://en.wikipedia.org/wiki/CIELUV)
* [x] [LCHuv](http://en.wikipedia.org/wiki/CIELUV#Cylindrical_representation)
* [x] [HSLuv](http://www.hsluv.org/)
* [x] [HPLuv](http://www.hsluv.org/)
* [x] [LABH](http://en.wikipedia.org/wiki/Lab_color_space#Hunter_Lab)
* [x] [YUV](https://en.wikipedia.org/?title=YUV)
* [x] [YIQ](https://en.wikipedia.org/?title=YIQ)
* [x] [YCgCo](https://en.wikipedia.org/wiki/YCgCo)
* [x] [YDbDr](https://en.wikipedia.org/wiki/YDbDr)
* [x] [YPbPr](https://en.wikipedia.org/wiki/YPbPr)
* [x] [YCbCr](https://en.wikipedia.org/wiki/YCbCr)
* [x] [YcCbcCrc](https://en.wikipedia.org/wiki/YCbCr#ITU-R_BT.2020_conversion)
* [x] [JPEG](https://en.wikipedia.org/wiki/YCbCr#JPEG_conversion)
* [x] [XvYCC](https://en.wikipedia.org/wiki/XvYCC)
* [x] [UCS](https://en.wikipedia.org/wiki/CIE_1960_color_space)
* [x] [UVW](https://en.wikipedia.org/wiki/CIE_1964_color_space)
* [x] [OKLAB](https://bottosson.github.io/posts/oklab/)
* [ ] [Munsell](https://en.wikipedia.org/wiki/Munsell_color_system)
* [ ] [NCS](https://en.wikipedia.org/wiki/Natural_Color_System)
* [ ] [PMS](https://en.wikipedia.org/wiki/Pantone)
* [ ] [RAL](https://en.wikipedia.org/wiki/RAL_colour_standard)
* [x] [TSL](https://en.wikipedia.org/wiki/TSL_color_space) – color space designed for face detection purpose.
* [ ] [RG](https://en.wikipedia.org/wiki/RG_color_space)
* [ ] [RGK](https://en.wikipedia.org/wiki/RG_color_space)
* [x] [Coloroid](https://en.wikipedia.org/wiki/Coloroid) — color space for architects and visual constructors, Hungarian Standard MSZ 7300 since 2000.
* [ ] [OSA-UCS](https://en.wikipedia.org/wiki/OSA-UCS) — accurately reprsenting uniform color differences, developed by the Optical Society of America’s Committee on Uniform Color Scales.
* [ ] [HKS](https://en.wikipedia.org/wiki/HKS_(colour_system))
* [x] [LMS](http://en.wikipedia.org/wiki/LMS_color_space) — represents sensitivity of the human eye to Long, Medium and Short wavelengths.
* [x] [Cubehelix](https://www.mrao.cam.ac.uk/~dag/CUBEHELIX/) — colormaps for data visualization.
* [ ] [Gray](http://dev.w3.org/csswg/css-color/#grays)
* [ ] [CIECAM02](https://en.wikipedia.org/wiki/CIECAM02)
* [ ] [US Federal Standard 595](https://en.wikipedia.org/wiki/Federal_Standard_595)
* [ ] [Toyo](http://mytoyocolor.com/)
* [ ] [PhotoYCC](http://www5.informatik.tu-muenchen.de/lehre/vorlesungen/graphik/info/csc/COL_34.htm)
* [x] [HCG](https://github.com/acterhd/hcg-legacy)
* [ ] [HCL](http://www.chilliant.com/rgb2hsv.html)
* [x] [HSP](http://alienryderflex.com/hsp.html)
* [ ] [HCY](http://chilliant.blogspot.ca/2012/08/rgbhcy-in-hlsl.html)
* [x] [YES](http://www.atlantis-press.com/php/download_paper.php?id=198) — computationally effective color space for face recognition.
* [ ] [British Standard Colour](http://www.britishstandardcolour.com/)
* [ ] [RG chromacity](https://en.wikipedia.org/wiki/Rg_chromaticity)
* [ ] [CIE DSH](https://en.wikipedia.org/wiki/Rg_chromaticity)
* [x] [HSM](http://seer.ufrgs.br/rita/article/viewFile/rita_v16_n2_p141/7428)## 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](https://github.com/Evercoder/culori), [colorjs.io](https://colorjs.io/docs/procedural), [color-api](https://github.com/LeaVerou/color-api), [texel/color](https://github.com/texel-org/color?tab=readme-ov-file),