Spectral.js: a JavaScript library that simulates realistic paint mixing using Kubelka-Munk theory.
Key features:
- Physics-based color blending using spectral reflectance curves
- Produces realistic browns and greens when mixing complementary colors
- Perceptually uniform color spaces (OKLab/OKLCh) for accurate gamut mapping
- Tinting strength control to balance dominant pigments
- GLSL shader support for WebGL projects
- Zero dependencies, 64-bit precision calculations
Perfect for digital painting apps, color palette tools, and generative art where color accuracy matters.
Mix colors like actual pigments instead of getting muddy RGB results.
π Blog Post
π GitHub Repo
π Live Demo
Top comments (0)