Skip to main content

OKLAB Cartesian Coordinate System

OKLAB is a Cartesian coordinate system for color representation, fundamentally different from the polar coordinate system used by OKLCH. While OKLCH uses Lightness (L), Chroma (C), and Hue (H) in a cylindrical arrangement, OKLAB uses three perpendicular axes.

Mathematical Relationship: OKLAB to OKLCH

The conversion between OKLAB (Cartesian) and OKLCH (Polar) follows standard coordinate transformation equations:
And the reverse transformation:

Coordinate System Comparison


The color-mix() Function

The color-mix() function was introduced in CSS Color Level 5 to enable programmatic color blending directly in CSS.
Where:
  • <color-space>: The interpolation color space (srgb, lab, oklab, oklch, etc.)
  • <color1>, <color2>: The colors to blend
  • <percentage>: Optional weighting (default 50% each)

Why OKLAB for color-mix()?

Interpolation Behavior: OKLAB vs sRGB


color-mix() Pattern Taxonomy

Implementation Examples

Notice the deliberate choice:
  • Hover states: Use oklch for hue preservation during lightening
  • Muted states: Use oklab for perceptually uniform transparency

TypeScript color-mix() Utilities


Color Space Decision Matrix


THE CENTER

How This Component Helps Visualize Information Flow

The OKLAB coordinate system and color-mix() function form the mathematical foundation of the Flow Color system. When a user hovers, clicks, or interacts with an element, the color “flows” from one state to another. OKLAB ensures these transitions appear natural and consistent to human perception. The key insight: straight-line interpolation in OKLAB space preserves perceived color quality, preventing the muddy intermediate colors that plague sRGB-based systems. This means information conveyed through color remains clear throughout all state transitions.

Transparency Patterns

Learn how transparency creates visual hierarchy through opacity gradients