Building Color Scales from 50 to 950
· 4 min read
Why HSL makes uneven tint and shade scales, how OKLCH keeps every step consistent across hues, and how to taper chroma and handle tricky hues.
A single brand color is not enough to build an interface. You need a pale version for backgrounds, a slightly darker one for hover states, a deep one for text on light surfaces, and so on. A color scale — the familiar 50 to 950 steps used by Tailwind and many design systems — gives you all of these from one hue, in a predictable order. This guide explains how to build one that behaves well.
What a scale is for
Each step in a scale has a typical job:
| Steps | Typical use |
|---|---|
| 50–100 | Tinted page sections, selected rows, subtle badges |
| 200–300 | Borders, dividers, disabled fills, focus rings on dark |
| 400–500 | Icons, illustrations, the "pure" brand color |
| 600–700 | Buttons with white text, links, hover states |
| 800–950 | Text on tinted backgrounds, dark mode surfaces |
The point is consistency. If 600 means "safe for white text" for blue, it should mean the same for orange, green and every other hue in the system. Then designers and developers can swap hues without re-checking every combination.
Why HSL makes uneven scales
The obvious approach is to keep the hue and saturation in HSL and step the lightness from 95% down to 10%. The result looks fine for one hue and falls apart across several, because HSL lightness is not how bright a color looks.
/* Same HSL lightness, very different real lightness */
--yellow: hsl(60 100% 50%); /* #FFFF00 */
--blue: hsl(240 100% 50%); /* #0000FF */Both colors have 50% lightness in HSL. Against white, yellow has a contrast ratio of 1.07:1 and blue 8.59:1. A "500" built this way would be invisible on white for yellow and fine for blue, and step numbers would mean nothing.
Use a perceptual space: OKLCH
OKLCH describes a color by lightness (L, 0 to 1), chroma (C, how colorful) and hue (H, an angle). Unlike HSL, its lightness is designed to match perceived brightness. Two colors with the same L look about equally light, whatever their hue. CSS supports it directly:
:root {
--blue-50: oklch(0.975 0.011 265);
--blue-500: oklch(0.600 0.217 269);
--blue-900: oklch(0.270 0.155 269);
}Building a scale in OKLCH means fixing a target lightness for each step and keeping the hue constant. Here are steps 500 and 600 for two very different hues, generated with the same lightness targets:
| Step | Blue | vs white | Orange | vs white |
|---|---|---|---|---|
| 500 | #4D6FFF | 4.17:1 | #CB5A00 | 4.20:1 |
| 600 | #344CEB | 6.21:1 | #A34600 | 6.12:1 |
The contrast lines up almost exactly. That is what makes a scale system trustworthy: "600 on white passes AA" becomes a rule rather than a coincidence. Tailwind v4 moved its default palette to OKLCH for the same reason.
Taper chroma at the ends
Keeping chroma constant across the scale causes two problems. Very light and very dark colors simply cannot be highly saturated on a normal screen — they fall outside the sRGB gamut and get clipped, often shifting hue. And even where they fit, a vivid 50 looks garish as a background.
So the usual curve is: chroma peaks around 400–600 and falls off toward both ends. The 50 step becomes a soft tint, the 950 step a deep near-neutral, and the middle carries the brand's full color.
Watch the problem hues
- Yellow is only vivid when it is light. Dark yellows look olive or brown. Many systems shift the hue slightly toward orange in the darker steps so they read as "deep amber" rather than "khaki".
- Blue and purple reach high chroma at low lightness, so the dark end can become intensely saturated. Pull chroma back so 900 still works as text.
- Cyan and green have a narrow gamut at the dark end and may need more hue adjustment to avoid muddy steps.
Small hue shifts across the scale — warmer at the light end, cooler at the dark end — can also make it feel more natural, the way real objects look warmer in light and cooler in shadow. Keep the shift small so the scale still reads as one color.
Neutrals need a scale too
Grays carry most of an interface: backgrounds, borders, secondary text. A neutral scale built the same way, with a tiny amount of chroma in the brand's hue, ties the interface together better than pure grays. A chroma of around 0.005 to 0.02 is enough to feel warm or cool without looking tinted.
Using the scale in code
Store the scale as primitive variables, then point role tokens at specific steps. In Tailwind v4, a scale in @theme becomes utilities like bg-brand-50 and text-brand-700:
@theme {
--color-brand-50: #F3F7FF;
--color-brand-100: #E3EBFF;
--color-brand-200: #C7D7FF;
--color-brand-300: #A3BBFF;
--color-brand-400: #7698FF;
--color-brand-500: #4D6FFF;
--color-brand-600: #344CEB;
--color-brand-700: #2331C1;
--color-brand-800: #171D98;
--color-brand-900: #0E1070;
--color-brand-950: #050249;
}Components should mostly use role tokens such as --color-primary rather than raw steps, so dark mode can remap them. See color tokens in CSS and Tailwind for that layer.
Generate one
The shade generator builds an 11-step scale from any color using the approach above: fixed OKLCH lightness per step, constant hue and chroma that tapers at the ends. You can copy individual steps or export the whole scale as a Tailwind v4 @theme block, a Tailwind v3 config, CSS variables or JSON.