color-space
v3.1.0
Published
Open collection of color-spaces
Readme
color-space

Open collection of color spaces.
- Verified formulas
- Conventional ranges
- Zero dependencies
- JS / WASM / GLSL / LUT / ICC.
Use
import space from 'color-space';
space.rgb.oklch(255, 128, 0); // → [0.732, 0.186, 53] — modern CSS
space.slog3.rec2020(0.5, 0.5, 0.5); // camera log → UHD wide gamut
space.rgb.xyz(300, -10, 0); // → [59.7, 30.6, 2.8] — out-of-range in, unclamped out
// batch
space.rgb.oklch([255, 128, 0, 0, 255, 128]); // [0.732, 0.186, 53, 0.875, 0.234, 151]
// meta
space.lab.range; // [[0, 100], [-125, 125], [-125, 125]]Individual spaces:
import oklch from 'color-space/oklch.js';
oklch.rgb(0.65, 0.25, 180); // matches CSS oklch(0.65 0.25 180)Imports
color-space– All 162 interconnected spaces · 55 kB gzipcolor-space/<name>.js– One standalone spacecolor-space/lite– 27-space working set · 9 kB gzipcolor-space/wasm– lite set as WASM · bare.wasmincludedcolor-space/gl– GLSL/WGSL shader sourcecolor-space/lut–.cubeLUTs for Resolve, Premiere, OBS, ffmpeg — verified vs ACEScolor-space/icc– Matrix + TRC or CLUT profilescolor-space/data.json– Channels, ranges, provenance, references, graph, gamutsnpx --yes --package color-space color-space-mcp– MCP agent tools:convert·space·spaces·cube
Spaces
Display & web sRGB · Display P3 · Rec. 2020 · Linear-light sRGB · Rec. 709 · ProPhoto RGB · Adobe RGB (1998) · DCI-P3 · Linear Display P3 · Linear Rec. 2020 · Linear Adobe RGB (1998) · Linear ProPhoto RGB · scRGB · RIMM RGB · CIE RGB · NTSC RGB (1953) · PAL / SECAM RGB · Apple RGB · SMPTE-240M
Cylindrical HSL · HSV / HSB · HWB · HSI · HCG · HCL · HSP · HCY · HSM
Perceptual — modern OKLCH · OKLab · HCT · Okhsl · Okhsv · Okhwb · OKLrAB · OKLrCH · SRLAB2 · proLab · sUCS · IgPgTg
Perceptual — CIE classic CIELAB · CIELChab · CIELUV · HSLuv · CIELChuv · CIELAB D65 · CIELCh D65 · HPLuv · DIN99o Lab · DIN99o LCh · DIN99d · Hunter Lab · CIE 1960 UCS · CIE 1964 UVW · Adams–Nickerson Lab
HDR & wide gamut ICtCp · Jzazbz · Rec. 2100 PQ · Rec. 2100 HLG · JzCzHz · IPT · Izazbz · Linear Rec. 2100 · hdr-IPT · hdr-CIELAB · ICaCb
Colorimetry & vision CIE XYZ (D65) · CIE xyY · LMS · CIE XYZ (D50) · CIE 1976 u′v′ · CCT + Duv · Color temperature (Kelvin) · Maxwell triangle · Wavelength · Absolute XYZ D65 · MacLeod–Boynton · DKL · Grayscale · Dominant wavelength / DSH · rg chromaticity · Yrg (Kirk 2019)
Video & broadcast BT.709 Y′CbCr · BT.2020 Y′CbCr · BT.601 525-line Y′CbCr · BT.601 625-line Y′CbCr · YCbCr (parameterized) · YUV · YIQ · YPbPr · YCgCo · JPEG YCbCr · YDbDr · YcCbcCrc · xvYCC · SMPTE-C · PhotoYCC
Film & camera ACEScg · ACEScc · ARRI LogC3 · Sony S-Log3 · Sony S-Gamut3.Cine · ACES2065-1 · ACEScct · ARRI LogC4 · Cineon · DaVinci Wide Gamut / Intermediate · Sony S-Log2 · Panasonic V-Log · RED Log3G10 · Canon Log · Canon Log 2 · Canon Log 3 · Fujifilm F-Log · Fujifilm F-Log2 · Nikon N-Log · Apple Log · Blackmagic Film Gen 5 · DJI D-Log · FilmLight T-Log / E-Gamut · DCDM X′Y′Z′ · Sony S-Log · ACESproxy · ERIMM RGB · Leica L-Log · GoPro Protune · Xiaomi Mi-Log · OPPO O-Log · REDLog · REDLogFilm · RED Log3G12 · Panalog · ViperLog · Filmic Pro 6
Appearance models CAM16 · CIECAM02 · CAM16-UCS · ZCAM · CAM02-UCS · CAM16-LCD · CAM16-SCD · CAM02-LCD · CAM02-SCD · Hellwig 2022 · RLAB · LLAB · Nayatani 95 · Hunt · ATD95
Print & physical CMYK · Munsell · RYB · CMY · RAL Design · Coloroid · Ostwald
Specialty & research XYB · OSA-UCS · TSL · YES · Ohta I₁I₂I₃ · lαβ
Motivation
A complete collection of color spaces: one minimal API, verified formulas. While alternatives focus on digital color spaces, this project takes broader perspective, covering historical and cross-disciplinary spaces as well. Side effects: corrected papers, color education, test cases for JS→WASM compilers (porffor, jz).
It is not a color toolbox — parsing, interpolation, ΔE, gamut mapping, contrast, palettes, alpha stay out. Pantone, NCS, RAL Classic, and similar licensed swatch catalogs aren't open and stay out as well.
Credits
Thanks to the researchers, theorists, specifiers, implementors — and the libraries that informed this one.
| Library | Spaces | Ranges | Specialty | Backends | Speed (op/s) | |---|---:|---|---|---|---:| | color-space | 162 | Conventional | ✅ | JS · WASM · GLSL/WGSL · LUT · ICC | 36.4 | | color-space/wasm | 27 | Conventional | — | WASM | 1.3–2.5× JS batches | | culori | ~35 | 0–1 | ❌ | JS | 16.1 | | colorjs.io | ~40 | 0–1 | some | JS | 0.7 | | texel/color | ~16 | 0–1 | ❌ | JS | 15.9 | | chroma-js | ~12 | mixed | ❌ | JS | 3.4 | | d3-color | 6 | mixed | ❌ | JS | 34.4 |
Full comparison · npm run benchmark
