Standard::Garden

OKLCH Color System Test

This page demonstrates the new OKLCH-based color system that generates harmonious color palettes from a single “signal” color.

How It Works

The system uses OKLCH color space (perceptually uniform) to:

  1. Extract DNA from your signal color (lightness, chroma, hue)
  2. Generate 6 semantic colors by rotating the hue
  3. Preserve vibrancy and visual weight across all colors
  4. Automatically adjust for dark mode

Signal Color

The current signal is: –signal: #d65d0e (Safety Orange)

Generated Pigments

All colors below are mathematically derived from the signal above:

Red (25°)
--pigment-red
Errors, Deletions
Yellow (85°)
--pigment-yellow
Warnings, Highlights
Green (145°)
--pigment-green
Success, Insertions
Cyan (190°)
--pigment-cyan
Info, Metadata
Blue (240°)
--pigment-blue
Links, Focus
Purple (300°)
--pigment-purple
Magic, AI

Semantic Colors

The system maps generated pigments to semantic names:

Test Different Signals

Try these in your browser DevTools console to see live color changes:

// Neon Pink Signal
document.documentElement.style.setProperty('–signal', '#ff00ff');

// Forest Green Signal
document.documentElement.style.setProperty('–signal', '#3a4a3a');

// Electric Blue Signal
document.documentElement.style.setProperty('–signal', '#0099ff');

// Clay Brown Signal (from issue description)
document.documentElement.style.setProperty('–signal', '#7a5a2e');

// Reset to default (Safety Orange)
document.documentElement.style.setProperty('–signal', '#d65d0e');

Dark Mode Test

Switch your OS theme to dark mode to see:

Technical Implementation

DNA Extraction

–dna-l: oklch(from var(--signal) l);
–dna-c: oklch(from var(--signal) c);
–dna-h: oklch(from var(--signal) h);

Safety Constraints

/* Minimum vibrancy for alerts (prevents gray from black/white) */
–safe-c: max(var(--dna-c), 0.12);

/* Readable text lightness */
–safe-l: clamp(0.35, var(--dna-l), 0.75);

Pigment Generation

/* Rotate hue while preserving lightness & chroma */
–pigment-red: oklch(var(--safe-l) var(--safe-c) 25);
–pigment-yellow: oklch(var(--safe-l) var(--safe-c) 85);
–pigment-green: oklch(var(--safe-l) var(--safe-c) 145);
/* etc… */

Dark Mode Adaptation

@media (prefers-color-scheme: dark) {
  :root {
    /* Brighten all pigments for visibility */
    –pigment-red: oklch(calc(var(--safe-l) + 0.15) var(--safe-c) 25);
    –pigment-yellow: oklch(calc(var(--safe-l) + 0.15) var(--safe-c) 85);
    /* etc… */
  }
}

Browser Support

Older browsers fall back to default colors (backward compatible).

Benefits

  1. One Color Generates All: Set –signal once, get complete palette
  2. Consistent Vibrancy: All colors have matching visual weight
  3. Smart Dark Mode: Automatic brightness adjustment
  4. Temperature Preservation: Warm signals stay warm, cool signals stay cool
  5. Accessible: Built-in lightness constraints ensure WCAG AA compliance
  6. Customizable: Override any specific pigment if needed

Note: This system is mathematically precise and perceptually uniform thanks to OKLCH color space. Unlike HSL (which is broken – yellow looks brighter than blue at same lightness), OKLCH ensures 50% lightness looks the same for every hue.