Spectral Color Mixing for Luminous UI
Move beyond RGB interpolation with a compact spectral model, metameric comparisons, perceptual mapping, gamut fallbacks, contrast proofs, and reproducible palettes.
Spectral color mixing asks what wavelengths a color emits or reflects before reducing the result to three display channels. This field note uses that extra structure to design luminous gradients, reveal metameric surprises, map results into OKLCH, and preserve accessible fallbacks on ordinary screens.
Spectral color mixing starts before RGB
RGB values describe device controls, not the full distribution of light that reaches an observer. Two different spectral power distributions can map to the same tristimulus color under one illuminant, then diverge under another. That metameric behavior is the creative opportunity and the reason to keep claims modest.
For interface work, a compact sampled spectrum is often enough to think with. Divide the visible range into perhaps sixteen or thirty-one bands, assign nonnegative power to each, and normalize against a declared white. Spectral color mixing can then show whether a cyan and amber combination builds a broad luminous plateau or a narrow, brittle spike before it becomes display RGB.
This is not a claim that a screen emits the modeled spectrum exactly. The browser ultimately drives red, green, and blue primaries whose real spectra depend on the panel. Treat the model as an art-direction instrument that produces structured color relationships, then validate the converted colors on actual target displays. The distinction keeps a poetic visual method connected to measurable boundaries.
- Cool: cyan-blue band
- Warm: amber-red band
- Overlap: shared energy
- Output: mapped display color
Choose samples, observer, and illuminant
A spectral study needs a wavelength range, sampling interval, observer functions, and illuminant or emissive assumption. Record those choices beside the palette. Changing a two-degree observer to a ten-degree observer or reflective daylight to an emissive display changes the meaning of the integration, even when the code still returns three numbers.
The CIE Colorimetry publication defines standard measurement foundations, while CVRL datasets provide research color-matching data. CSS Color Module Level 4 specifies how the converted result can enter web color spaces. These references anchor distinct steps; none guarantees that an arbitrary consumer panel matches a laboratory observer.
Name the spectral power distribution source honestly. A measured LED spectrum, a published pigment curve, and an invented Gaussian band are different materials. Synthetic curves are excellent for generative composition when labeled as such. Store wavelength, value, units or normalization, provenance, license, and any smoothing so later palette revisions do not masquerade as the same experiment.
Compose a spectral ribbon, not a rainbow ramp
Begin with two distributions that have legible shapes: a cool band with energy around cyan-blue wavelengths and a warm band spanning yellow-red. Interpolate power band by band, then convert each mixture step through the same observer and white. The resulting ribbon usually changes in a less uniform way than channel interpolation, which can create useful luminous pauses.
The SVG visual plots stylized bands and their combined envelope. Its HTML legend repeats the meaning so color is not the only signal. Spectral color mixing becomes composition when the peaks, overlap, and negative space are art-directed, rather than when a scientific chart is merely pasted into a hero.
Keep intensity and chromatic path separate. Normalize every mixture to equal luminance for one proof, then allow controlled luminance shaping for the final interface. This comparison reveals whether the apparent glow comes from hue interaction or simply from making the middle brighter. Save both results; the neutral proof is the better diagnostic, while the authored version may be the better artwork.
| Study | Spectrum | Display | Role |
|---|---|---|---|
| A | Broad cool | Cyan | Open |
| B | Warm peaks | Amber | Focused |
| M1 | Equal mix | Green-gold | Bridge |
| M2 | Metamer | Near M1 | Hidden structure |
Use metamers as a design constraint
Build two spectra that land near the same displayed color under the chosen conversion, then show how their internal bands differ. They are a matched pair in the interface but carry different generative identities. A hover, scroll, or data transition can morph between them while holding the endpoint color nearly stable, creating motion inside apparent stillness.
Do not describe that transition as physically visible if the converted RGB remains identical. To reveal it, the design must intentionally change the observer assumption, illuminate a simulated material, or expose the spectral diagram. Metameric color is valuable because it separates appearance from composition, not because it supplies a mystical hidden color.
The comparison table gives each spectrum a shape, display result, and intended role. One broad distribution can represent an open state; a spiky distribution can represent constrained energy. Spectral color mixing supplies the in-between path, while semantic labels and typography carry the product meaning. Users never need color science knowledge to understand whether a control is active.
Map the result into perceptual design tokens
Convert the integrated XYZ result into a declared output space, then examine it in OKLCH for palette control. Preserve the spectral mixture parameter as provenance, but expose lightness, chroma, and hue to the design system. Those perceptual coordinates are easier to bound across surfaces, text, borders, and states than raw device channels.
Create tokens for spectral source A, source B, neutralized mixtures, authored luminous mixtures, and safe fallbacks. The resulting OKLCH palette keeps perceptual edits legible. The runnable fixture verifies only the mixture's mathematical bounds; the browser proof must additionally check conversion, gamut mapping, and contrast. Spectral color mixing is not finished when a vector contains finite values.
When a mixture leaves the target gamut, compare chroma reduction, local gamut mapping, and an art-directed replacement. Record which method was used per target space. A clipped conversion can flatten the very transition the spectral model introduced. The token receipt should include spectrum IDs, mixture ratio, observer, white, conversion library or formula, gamut strategy, and final CSS value.
The small fixture treats a spectrum as four sampled bands, mixes them linearly, and verifies both physical bounds and order independence before any display conversion is applied.
Runnable artifact — spectral-mix-fixture.test.mjs
import assert from "node:assert/strict";
const add=(a,b,t=.5)=>a.map((v,i)=>v*(1-t)+b[i]*t);const cyan=[.05,.42,.9,.3],amber=[.8,.55,.08,.2];const left=add(cyan,amber,.35),right=add(amber,cyan,.65);
assert.deepEqual(left,right);assert.ok(left.every(v=>v>=0&&v<=1));assert.notDeepEqual(left,[.5,.5,.5,.5]);
console.log("PASS: spectral mix stays bounded and order independent");
Run node spectral-mix-fixture.test.mjs. Expected receipt: PASS: spectral mix stays bounded and order independent.
Protect text and controls from luminous color
Keep expressive gradients behind content or inside nonessential artwork. Text, focus indicators, control boundaries, and status differences need explicit contrast proofs at resolved colors, states, and backgrounds. A glowing center that looks beautiful in a large swatch may erase a small label or make a focus ring disappear.
Test the palette at 360 pixels, 200% zoom, dark and light themes, reduced transparency, forced colors, and common display gamuts. Provide a stable solid-color fallback when color interpolation or wide-gamut color is unsupported. The accessible interface should not depend on perceiving the spectral path, and reduced motion should freeze any animated mixture on an intentional frame.
Use spectral color mixing as ornament with accountable edges. The bright region can attract attention toward a diagram or artwork, while a quiet surface carries reading. Treat flare, blur, and blend modes as separate effects with their own bounds. Otherwise a disciplined spectral study becomes a conventional glow stack whose contrast changes unpredictably with backdrop content.
Place the experiment inside the web color stack
The surrounding craft is already documented in the Journal. Display P3 CSS color systems handles wide-gamut delivery; OKLCH design tokens provides a maintainable palette language; chromatic aberration design separates channel motion from readable cores; and APCA vs WCAG contrast keeps diagnostics distinct from conformance.
Those layers prevent spectral color mixing from becoming a monolithic color theory. The spectral model proposes relationships, perceptual tokens make them editable, CSS spaces deliver them, and contrast checks decide where they may appear. A change in one layer should not silently rewrite another.
For a worked interface, use the ribbon as the background of a model-comparison header. The central mixture marks shared capability; cooler and warmer endpoints label distinct strengths. Repeat the categories in text, keep cards on opaque surfaces, and let a small spectral plot explain the visual idea. The graphic supports the comparison instead of pretending hue alone is data.
Inspect the fallback beside its wide-gamut counterpart under the same typography, surface colors, dim mode, and simulated vision conditions. Retain both token sets with the sampled spectral inputs and contrast receipts, so a future gamut remap can preserve the intended luminous hierarchy rather than merely matching coordinates.
- 1Sample
Declare wavelength bands
- 2Mix
Interpolate nonnegative power
- 3Integrate
Apply observer and white
- 4Map
Create accessible CSS tokens
Archive a luminous palette as an edition
Save source curves, sampling grid, observer data, illuminant assumption, conversion code, mixture ratios, normalization, gamut mapping, CSS tokens, contrast results, display notes, and final social-card output. Include a plain sRGB image and the semantic legend. This makes the artwork repeatable even when browsers or panels change.
The release review for spectral color mixing compares the neutral-luminance ribbon, authored ribbon, grayscale image, sRGB fallback, Display P3 version, and 200% zoom. Stop when mixture bands produce non-finite or negative power, conversion clips an essential region without disclosure, labels rely on color alone, or a control misses its current contrast requirement.
Revisit the palette when a target gamut, theme, rendering engine, or surrounding surface changes. The model does not need to simulate every photon to be worthwhile. It needs to reveal more structure than ordinary channel interpolation and preserve enough evidence that another designer can distinguish measured inputs, synthetic choices, and final art direction.
Preserve the luminous idea across displays
A spectral model earns its place when it reveals an editable structure that RGB interpolation hides, then hands the result back to ordinary web color, contrast, and fallback systems. Keep the scientific vocabulary precise and let the visual imagination live in the distributions you author.