Web, print, photography, film, broadcast, art, science, and history. Canonical conversions, channels, gamut shapes, provenance, cited references, known limits. Convert any space to any other: rgb to oklch, slog3 to rec709, cct-duv to rgb.
import space from 'color-space' space.rgb.oklch(255, 128, 0) // → [0.732, 0.186, 53] space.oklch.rgb(0.65, 0.25, 180) // any of 162 × 161 pairs space.oklch.name // 'oklch' space.oklch.range // [[0,1], [0,0.4], [0,360]] // one space only — tree-shaken, 0.4-1.5 kB import oklch from 'color-space/oklch.js' oklch.rgb(0.65, 0.25, 180)
// values in the notations CSS already speaks — straight from the library color: oklch(0.732 0.186 53); // space.rgb.oklch(255, 128, 0) color: color(display-p3 0.936 0.529 0.199); // space.rgb.p3(255, 128, 0) color: color(xyz-d65 0.49 0.367 0.045); // space.rgb.xyz(…) / 100 — exact interchange // spaces CSS lacks ship as ICC profiles or LUTs — see those tabs; // every dossier's css tab writes the current color in copyable forms
// per-space metadata — sourced, ships as data.json
import data from 'color-space/data.json' with { type: 'json' }
const m = data.spaces.oklch
m.channels // [{symbol, min, max, name}, …]
m.refs // defining spec / paper links
m.year, m.by // 2020 · 'Björn Ottosson'
// scalar or whole-buffer, zero-copy — a true WASM kernel
import space, { alloc } from 'color-space/wasm'
space.oklch.rgb(0.72, 0.16, 41) // → [246, 125, 79]
const buf = alloc(n) // n×3 Float64Array
space.rgb.oklch(buf) // in place — 27 spaces
// every pair as a GLSL shader chunk
import { glsl } from 'color-space/gl'
import oklch from 'color-space/gl/oklch'
const src = glsl(oklch, 'rgb')
// → self-contained: vec3 oklch_rgb(vec3 c)
// paste into any fragment shader, no uniforms
Any pair as a .cube LUT — load it into Resolve, Premiere, Final Cut, OBS or ffmpeg. Camera logs are verified against the official ACES vendor transforms.
Any space as an .icc v2 profile — matrix + tone curve for RGB working spaces (Photoshop, OS colour management), a CLUT lattice for everything else (lcms, ArgyllCMS, ImageMagick).
component
scene-referredHDRlogD65
N-Log → Linear-light Rec. 2020 → CIE XYZ → sRGB
N is Nikon; N-Gamut, its matching primaries, shares BT.2020 chromaticities
2018, Nikon
Log video capture for Nikon Z-series mirrorless cameras; current, defined over N-Gamut (BT.2020 primaries).
import space from 'color-space' space.nlog.rgb(0.54, 0.41, 0.31) // → [246, 125, 79] space.rgb.nlog(246, 125, 79) // → [0.54, 0.41, 0.31] // route: nlog → rec2020-linear → xyz → rgb // one space, tree-shaken (0.4-1.5 kB): import nlog from 'color-space/nlog.js'