Image & Video

Naoyuki Uchida's COFb halves color cast in OKLCH gradients with a differentiable chroma gate

A single-parameter blend slashes unwanted hue detours by 50% in interpolations

Deep Dive

Color interpolation in CSS gradients and color-mix() often uses OKLCH, the cylindrical form of Oklab. While OKLCH preserves perceptual uniformity, its polar parameterization introduces two types of color cast: (1) an inter-hue detour between two chromatic endpoints (e.g., blue to yellow passes through green), and (2) an off-line bow when one endpoint is achromatic. Existing remedies are uniformly two-valued—a threshold switch that fires only at an achromatic endpoint—so they only fix type (2), leaving the inter-hue cast untreated. This has been a persistent issue in web design, image processing, and video pipelines where smooth, cast-free gradients are critical.

Naoyuki Uchida's Continuous Oklab fallback (COFb) introduces a single-parameter, differentiable chroma gate w(C)=C^n/(C^n+σ^n) that continuously blends the OKLCH path toward the linear Oklab path as chroma falls. With default n=1 (rational Michaelis-Menten form) and σ≈0.19 for a typical sRGB palette, COFb halves the inter-hue path detour (mean lateral deviation -49.5%, chroma-weighted hue excursion -35.5%). Uchida characterizes a cast-hue trade-off frontier and verifies the gate symbolically. COFb's key advantage: it unifies treatment of both cast types without any endpoint test. Limitations include modest performance on type (2) alone compared to the two-valued switch, and chroma not being preserved. The method runs entirely in plain Oklab(a,b)-to-sRGB, making it drop-in compatible with older CSS engines, image and video pipelines, and GPU shaders that lack modern CSS color interpolation.

Key Points
  • COFb uses a differentiable chroma gate w(C)=C^n/(C^n+σ^n) to continuously blend OKLCH toward Oklab interpolation as chroma decreases.
  • At default settings (n=1, σ≈0.19), COFb reduces mean lateral deviation by 49.5% and chroma-weighted hue excursion by 35.5%.
  • The method runs in plain Oklab-to-sRGB, enabling use in older rendering engines where modern CSS color-mix(in oklch) is unavailable.

Why It Matters

Web and graphics professionals can now eliminate unwanted color casts in gradients without sacrificing performance or backward compatibility.

📬 Get the top 10 AI stories daily