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 168 × 167 pairs
space.oklch.name // 'oklch'
space.oklch.range // [[0,1], [0,0.4], [0,360]]// one space only – tree-shaken, 0.4-1.5 kBimport 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.jsonimport 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 kernelimport 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 chunkimport { 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