Spectral.js is a lightweight JavaScript library for realistic pigment mixing, using the Kubelka-Munk theory to simulate how real paints absorb and scatter light.

Unlike typical RGB blending, spectral.js calculates pigment interactions through spectral reflectance and colorimetric math — including OKLab, OKLCh, and ΔE gamut mapping — for accurate, perceptual mixing.

Selected color

Color 1
1.00
Color 2
1.00
Color 3
1.00




Setup
Mix
Palette
Gradient
Multi-color mix
Available on GitHub