OKLCH Composer

A color utility system for Tailwind v4 that decomposes every color into three independent axes — luminance, chroma, and hue — and lets them cascade through the DOM. Set a color on a parent, override one axis on a child. No opacity hacks. Re-theme your entire app by changing one variable.

Theme Hues

260°
30°
145°
55°
15°
220°

5×5 Luminance × Chroma Grid

Each matrix shows all combinations of luminance (rows) and chroma (columns) for a given hue. Hover to see the class name.

primary (260°)

C:lo
C:mlo
C:mid
C:mhi
C:hi
L:lo
L:mlo
L:mid
L:mhi
L:hi

accent (30°)

C:lo
C:mlo
C:mid
C:mhi
C:hi
L:lo
L:mlo
L:mid
L:mhi
L:hi

success (145°)

C:lo
C:mlo
C:mid
C:mhi
C:hi
L:lo
L:mlo
L:mid
L:mhi
L:hi

warning (55°)

C:lo
C:mlo
C:mid
C:mhi
C:hi
L:lo
L:mlo
L:mid
L:mhi
L:hi

danger (15°)

C:lo
C:mlo
C:mid
C:mhi
C:hi
L:lo
L:mlo
L:mid
L:mhi
L:hi

info (220°)

C:lo
C:mlo
C:mid
C:mhi
C:hi
L:lo
L:mlo
L:mid
L:mhi
L:hi

Live Component Examples

Subtle Card

bg-hi-lo-primary + text-lo-mid-primary. Low chroma background, strong text. Portable anywhere.

bg-mid-mhi-primary

Cascade Override

Parent sets bg-mid-hi-accent. Children inherit chroma + hue, override only luminance — no need to redeclare the full color.

bg-l-lo
bg-l-mhi
bg-l-hi

Success State

bg-hi-lo-success with mid-chroma border. Same pattern, different hue — instant semantic color.

bg-mid-mhi-success

Danger Alert

bg-lo-mid-danger. Deep, saturated backgrounds that read correctly regardless of context.

Acknowledge

Multi-Hue Composition

Primary container with accent and warning badges, no transparency needed:

accent warning success

Axis Inheritance

Parent sets hue to primary. Children swap only the hue axis — luminance and chroma stay inherited.

bg-h-success bg-h-warning bg-h-danger

Implementation

/* ── your-project.css ────────────────────────────────────────
   Import tailwind-oklch into your Tailwind v4 project. */

@import "tailwindcss";
@import "tailwind-oklch";
@plugin "tailwind-oklch/plugin";

/* That's it. You now have:

   SHORTHAND    bg-mid-hi-primary        one class, full color
   DECOMPOSED   bg-l-mid bg-c-hi bg-h-primary   per-axis control
   CASCADING    parent sets color, child overrides one axis

   To customize hues, override in your own @theme block: */

@theme {
  --hue-primary: 180;  /* teal instead of purple */
  --hue-accent:  320;  /* pink instead of orange */
}