whitepoint
a research-grade color laboratory for the web
Every color space, every illuminant — digit-identical in JS, GLSL, and WGSL. Every constant cited, every matrix derived, every claim measured. Every color on this page is computed by the library, right now, in your browser.
npm install whitepoint
the neon alley — why we built this
A rain-wet alley at night, every light derived from NIST atomic spectra: there is no standard illuminant for neon, so the library computes one from Einstein coefficients. One toggle flips the whole scene between the naive sRGB pipeline every web demo uses and the whitepoint pipeline — spectra to XYZ to emitted, parity-tested shaders, exact-cusp gamut mapping, display-p3 out. Flip the switch →
Mix in any space — and see why it matters
The same two endpoints, interpolated per CSS Color 4 in five different
spaces. Naive sRGB mixing drags through mud; perceptual spaces don't. Every strip is
mix() running live.
The illuminant lab
One object color, re-lit. Chromatic adaptation between arbitrary white points — named CIE illuminants, or any correlated color temperature on the daylight locus. No other JS library does this.
Physics, live: the Planckian locus
Blackbody color from 1,000 K to 20,000 K (mired-linear axis), each column computed by integrating Planck's law against the CIE color matching functions, right now, and shown at the maximum brightness sRGB can carry its chromaticity. Not a fitted approximation: the law itself. (A blackbody never reaches saturated blue — the locus asymptotes at a pale sky-blue. Physics, not a bug.)
Your shader, our constants
Conversions, gradient mixing, gamut mapping, and compositing emitted as GLSL or WGSL — generated from the same constant tables the JS uses, parity-tested in CI. Stop hand-porting color matrices.
Only here
Shader codegen with CPU parity
GLSL + WGSL + JS from one table of cited constants — conversions, OKLCH mixing, gamut mapping, Porter-Duff, blend modes. Digit-identical by construction, verified in CI.
Arbitrary illuminants & CATs
Bradford, CAT02, CAT16, von Kries — between any white points, including CCT-derived daylight. The full CIE illuminant table, computed inverses.
Spectral colorimetry
Reflectance under any light, the true Planckian locus from Planck's law, CIE daylight synthesis, both standard observers. Previously Python-only.
CAM16 + HCT
A full color appearance model with configurable viewing conditions, CAM16-UCS, and Material's HCT — in no other JS library.
Exact gamut geometry
The cusp and boundary are solved, not fitted: 3×10⁻¹⁵ on the boundary at every hue, where the reference fits err by up to 3×10⁻² near blue. Same speed.
Measured, published precision
A full-catalog round-trip error table regenerated in CI; differential oracles against culori, colorjs, texel, and Material — with every disagreement explained.
Honest comparison
| whitepoint | culori | colorjs.io | @texel/color | |
|---|---|---|---|---|
| Conversion speed (fastest measured) | yes | — | — | close |
| Shader codegen (GLSL/WGSL) | yes | no | no | no |
| Arbitrary illuminants + CATs + CCT | yes | no | partial | no |
| Spectral (CMFs, Planck, daylight) | yes | no | no | no |
| CAM16 / HCT | yes | no | yes | no |
| Published precision bounds | yes | no | no | partial |
| CSS string parsing | yes (CSS Color 4) | yes | yes | partial (hex) |
Parsing covers the frozen CSS Color 4 grammar
(hex, the 148 named colors, every Level 4 functional form) in a fenced module that
tree-shakes away if unused; Level 5 relative-color and calc() wait for the spec to freeze.
Speed and accuracy claims are reproducible:
npm run bench, npm run precision.