Palg

Gradients that don’t band

By Theo Lane (pen name; AI-assisted, hand-checked) ·

Gradients are back in interface design, and with them two old problems: muddy midpoints and visible stripes called banding. Both have well-understood causes and simple fixes.

Problem one: the muddy middle

By default, CSS and most design tools interpolate gradients in sRGB: they average the red, green and blue values. When two endpoint colors are far apart in hue — blue and yellow, say — the average of their channels is a desaturated gray-ish color. The result is a dull band in the middle of what should be a vivid transition.

Interpolating in a perceptual space fixes this. In OKLab, a straight line between two colors keeps perceived lightness changing steadily and avoids the dip in chroma. In OKLCH, interpolation walks around the hue wheel, keeping chroma high all the way — great for rainbow-like transitions, though it can introduce hues you did not expect if the endpoints are far apart. CSS Color 4 lets you choose:

background: linear-gradient(in oklab, #1d4ed8, #facc15);
background: linear-gradient(90deg in oklch, #1d4ed8, #facc15);
background: linear-gradient(in oklch longer hue, red, red);

All current major browsers support this syntax. For older ones, Palg’s gradient maker writes a fallback line with extra precomputed stops so the transition still looks perceptual.

Problem two: banding

Banding happens when a gradient spans a large area but there are only a few distinct color values available along it. An 8-bit-per-channel display has 256 levels per channel; a gradient from #1a1a2e to #16213e across a 1600-pixel hero has only a handful of distinct values per channel, so each value is drawn as a stripe many pixels wide. Our eyes are especially good at spotting edges in dark, low-contrast regions, which is why dark gradients band most visibly.

Fixes, roughly in order of effort:

Choosing gradient colors

Linear, radial, conic

Linear gradients suit backgrounds and buttons. Radial gradients suggest light sources and depth; keep them subtle in UI. Conic gradients sweep around a point and are useful for pie charts, color wheels and decorative rings. SVG supports linear and radial gradients natively but not conic, so export conic designs as CSS or PNG.

Accessibility and motion

Animated gradients can be distracting or trigger discomfort for people with vestibular disorders. Respect prefers-reduced-motion and keep animations slow and optional.

Gradients in design systems

If gradients are part of your brand, treat them like any other token. Name them by purpose (hero background, promotional banner, chart highlight) rather than by color, store the stops and interpolation space in code, and document where each may appear. A gradient defined once as a CSS custom property — for example --gradient-hero — is easy to update everywhere when the palette changes, and it keeps teams from improvising slightly different blends that drift apart over time. Pair each gradient with the text color that is approved on top of it and the contrast ratio measured at its weakest point, so that nobody has to guess whether a headline will be readable.

Workflow in Palg

  1. Open the gradient maker and set two stops.
  2. Toggle between sRGB and OKLCH and compare the strips beneath the preview.
  3. Add a mid stop if the transition still looks off.
  4. Copy the CSS (with fallback), or export SVG or PNG.
  5. Save it to your library next to the palette it belongs to.

More guides