Skip to content
IndexRequest a UIAboutContact

Gradient Interpolation Spaces

The same two colours blended in sRGB, HSL and OKLCH, showing why some gradients go grey and muddy in the middle.

Open alone ↗

AI prompt

PROMPT: PASTE INTO YOUR AI IMAGE OR VIDEO TOOL
Colour theory sheet showing the same two-colour gradient from saturated blue to bright yellow in three horizontal bars: top bar blended in sRGB passing through a dull grey middle, middle bar blended in HSL passing through a vivid green and cyan, bottom bar blended in OKLCH passing through a clean even green, labelled sRGB, HSL and OKLCH beneath each, flat layout on a white background, generous spacing. Negative: banding, noise, text errors, decorative frames. Reduced motion: static sheet.

About this pattern

Definition

A gradient is a path between two colours, and the path depends on the colour space it is blended in. Plain sRGB blending runs straight through the middle and can turn grey; HSL swings around the hue wheel and can look garish; OKLCH keeps lightness and chroma steady and gives smooth, vivid blends.

When to use it

  • Blue to yellow in sRGB passes through dull grey; in OKLCH it passes through a clean green.
  • CSS can choose the space: linear-gradient(in oklch, blue, yellow).
  • Check the hue path too: oklch has shorter and longer hue arcs for control.

What the controls do

  • Two colour pickers and quick pairs; three bars show each interpolation space.

Motion & timing

  • Bars update on input; no animation.
  • Reduced motion: nothing to change.

Tips & variations

  • Provide a fallback for browsers without support: a plain gradient still works.
  • Test text over the gradient at several points, not just the ends.

Code of this live preview

HTML
<div class="bx"><div class="two"><label class="rw">From<input id="c1" type="color" value="#1f4fd8"></label><label class="rw">To<input id="c2" type="color" value="#ffd23f"></label></div><div class="pre" id="pre" role="group" aria-label="Pairs"><button data-p="0" aria-pressed="true">Blue to yellow</button><button data-p="1" aria-pressed="false">Red to green</button><button data-p="2" aria-pressed="false">Purple to orange</button></div><div class="gs" id="gs"></div></div>

Related patterns

Grainy Gradient Backgrounds

↗
Grainy Gradient BackgroundsColour Techniques

Tint, Shade & Tone Ramps

↗
Tint, Shade & Tone RampsColour Techniques

Monochrome, Complement & Duotone

↗
Monochrome, Complement & DuotoneColour Techniques