OKLCH -- the cylindrical (lightness, chroma, hue) form of Ottosson's Oklab color space -- is the interpolation space recommended by CSS Color 4 for gradients and color-mix(), and it is now broadly deployed. Its polar parameterization, however, casts color near the neutral axis in two ways: (1) an inter-hue detour between two chromatic endpoints that sweeps through an unintended hue (blue to yellow visibly passing 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 address only (2); on chromatic pairs every one of them reduces to raw OKLCH, leaving the (1) inter-hue cast untreated. We introduce Continuous Oklab fallback (COFb), a one-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. A single gate reduces the (1) cast that the two-valued family leaves untreated and unifies the handling of (1) and (2) without any endpoint test. We characterize a cast-hue trade-off frontier, adopt a default ($n=1$, the rational Michaelis-Menten form; $σ\approx0.19$ for a typical sRGB palette, from a normalization-independent cast-half criterion), and verify the gate's properties symbolically. At the default, COFb halves the inter-hue path detour (mean lateral deviation -49.5%, chroma-weighted hue excursion -35.5%). We also state the method's limits: on (2) alone the two-valued switch remains better, and like any Cartesian blend COFb does not preserve chroma. In deployment, COFb runs entirely in plain Oklab (a,b) to sRGB, so it serves as a fallback that delivers the same cast-reduced gradients where modern CSS color interpolation (color-mix(in oklch) and the like) is unavailable -- older engines, image and video pipelines, or GPU shaders.
翻译:OKLCH(即Ottosson Oklab色彩空间中圆柱形式的明度、色度、色调)是CSS Color 4标准中推荐用于渐变和color-mix()的插值空间,现已广泛部署。然而,其极坐标参数化会在中性轴附近产生两种色偏:(1) 在两个彩色端点间沿色调间绕行路径时,会扫过非预期的色调(例如蓝色到黄色会明显经过绿色);(2) 当某一端点为消色差时产生离轴弧线。现有修正方案均为二值化——仅在消色差端点处触发的阈值开关——因此仅能处理(2)类色偏;对于彩色对组合,这些方案均退化为原始OKLCH,未处理(1)类色调间色偏。我们提出连续Oklab回退方法(COFb),这是一种单参数可微分色度门控函数$w(C)=C^n/(C^n+σ^n)$,可在色度降低时连续地将OKLCH路径向线性Oklab路径混合。该单一门控既能减少二值化方案未处理的(1)类色偏,又无需端点判断即可统一处理(1)(2)两类问题。我们刻画了色偏-色调权衡前沿曲线,采用默认参数($n=1$,即有理米氏函数形式;基于归一化无关的半色偏准则,典型sRGB调色板的$σ\approx0.19$),并通过符号运算验证了门控函数性质。在默认参数下,COFb可将色调间路径绕行减半(平均横向偏差降低49.5%,加权色度色调偏移降低35.5%)。同时我们指出了该方法的局限性:对于(2)类色偏,二值化开关仍表现更优;且与所有笛卡尔混合方法类似,COFb无法保持色度。在部署方面,COFb全程在纯Oklab(a,b)到sRGB中运行,因此可在缺乏现代CSS颜色插值(如color-mix(in oklch)等)的环境——旧版引擎、图像与视频流水线或GPU着色器——中作为回退方案,提供同等色偏减少的渐变效果。