# rvanwijnen/spectral.js

Spectral.js is a paint like color mixing library utilizing the Kubelka-Munk theory.

Repository: https://github.com/rvanwijnen/spectral.js
Canonical: https://ross.abutalabs.com/products/spectraljs
Homepage: https://spectraljs.com/
Language: HTML
License: MIT
License Family: permissive
Topics: color, colors, kubelka-munk, paint, blend, blending, gradient, mixing, palette, pigment
Last push: 2026-01-01T16:12:50+00:00

## Health v2 (maintenance only)
Score: 48/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 60, release rhythm 8, longevity 89
- inputs: {"age_days": 1248, "days_push": 244, "days_rel": 495, "gap_med": null, "n_releases_24m": 1}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1220, forks 27 (observed 2026-08-28T04:04:01.969758+00:00)

## What it is
Spectral.js is a lightweight JavaScript library for realistic paint-like color mixing based on the Kubelka-Munk theory, simulating how pigments absorb and scatter light. It uses spectral reflectance and perceptual color spaces like OKLab and OKLCh with gamut mapping, rather than simple RGB blending.

## Use cases
- mix colors like real paint in javascript
- create realistic color gradients in the browser
- build a digital painting app with pigment mixing
- generate paint-like color palettes
- blend colors physically accurately instead of RGB
- implement a color picker with realistic mixing
- creative coding with spectral color blending

## When to choose
- you need physically plausible pigment mixing rather than RGB interpolation
- you're building painting tools, color pickers, or palette generators in JavaScript
- you want perceptually uniform color math with OKLab/OKLCh and gamut mapping
- you need a lightweight, dependency-free color mixing library

## When to avoid
- you just need simple linear RGB or HSL blending
- you need full multi-constant Kubelka-Munk with measured pigment data
- you're working outside JavaScript/browser environments
- performance-critical pixel loops where spectral math is too heavy

## Facets
- artifact type: library
- maturity: active
- function: graphics, image-processing, math
- domain: graphics, web-development, frontend
- platform: browser, cross-platform
- tags: color-mixing, kubelka-munk, pigment, color-science, oklab, gradient, palette, creative-coding, game-development, nodejs, javascript

## Member repositories
- rvanwijnen/spectral.js (main) score 48

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:01.969758+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T06:16:10.073821+00:00, confidence not recorded.
  - readme: https://github.com/rvanwijnen/spectral.js (fetched 2026-08-28T04:04:01.969758+00:00, sha 892feb29d0d0)
  - homepage: https://spectraljs.com/ (fetched 2026-08-29T12:24:22.899509+00:00, sha c9faa9f44018)
- Data as of 2026-08-30T08:39:29.467469+00:00.
