Docs Navigation (Core Strategies)›

03. Perceptual OKLab Color Strategies

Why SimplexViz assigns cluster hues via perceptual OKLab graph-coloring optimization and mixes multi-cluster items without muddy sRGB midpoints.

  • Core Strategies
  • 2 min read
  • Updated 2026-11-15

Key Takeaways

  • Adjacent mesh vertices maximize minimum perceptual distance ΔE_OK via greedy seeding plus pairwise swap refinement.
  • Barycentric item colors interpolate in Björn Ottosson's OKLab space with chroma preservation so bridge items stay vivid and legible.
  • Hungarian cluster matching preserves assigned vertex colors across live item additions, removals, and resizes.

Stage 3 (SimplexColorStrategy) assigns a canonical hex color to each vertex cluster and computes mixedColorHex for every content item from its barycentric simplex weights (w₁, …, w_m).

OKLab Edge Contrast Optimization

Adjacent mesh vertices maximize perceptual distance ΔE_OK

max min ΔE_OK

Barycentric Mixing: sRGB vs. OKLab

Preserves lightness L and chroma C across bridge items

Naive sRGB average (muddy midpoint)SimplexViz OKLab mix (vivid chroma)
Left: Pairwise edge swaps on the 60° mesh maximize minimum perceptual ΔE_OK between neighboring clusters. Right: Interpolating in OKLab preserves uniform lightness and chroma compared to desaturated sRGB averaging.

Why sRGB Fails on Triangulated Meshes

Linearly averaging sRGB hex values along a mesh edge—for instance between Cyan (#06B6D4) and Amber (#F59E0B)—collapses perceptual lightness and chroma near w = (0.5, 0.5), turning bridge items into dull grey-brown dots that look visually inactive rather than interdisciplinary.

SimplexViz converts cluster colors into OKLab (L, a, b), computes the weighted barycentric sum, gently restores perceptual chroma C = √(a² + b²) toward the weighted mean chroma of the contributing clusters, and clamps cleanly into the sRGB gamut.

Strategy Decision Matrix

Custom Brand Palette Example

import { createPaletteColorStrategy } from '@simplex-viz/core';

const corporatePalette = createPaletteColorStrategy(
  ['#0891b2', '#d97706', '#c026d3', '#059669', '#2563eb', '#e11d48'],
  {
    mode: 'edge-contrast',
    preserveMatchedColors: true,
  },
);