How to choose a colour palette for a website
One brand scale, one neutral scale and a few status colours, with steps assigned by measured contrast. Tailwind’s own scales measured in light and dark.
- Tailwind CSS 4.3.5 palette
- WCAG 2.2 contrast
A website palette needs fewer colours than most people start with: one brand colour in a full scale of light to dark steps, one neutral scale for text, borders and backgrounds, and three or four status colours. Pick the brand colour, build its scale, then choose which steps do which job by measuring contrast, not by eye. That last step is where most palettes fail.
This is how we pick colours for our own themes, with the numbers we measured along the way.
What a palette actually contains
| Role | How many | Used for |
|---|---|---|
| Neutral scale | 1 scale, about 11 steps | Text, muted text, borders, backgrounds, panels. Most of every page. |
| Brand colour | 1 scale | Primary buttons, links, focus rings, small accents |
| Status colours | 3 or 4 (error, warning, success, info) | Form errors, alerts, badges |
| Accent | 0 or 1 | Only if the brand truly has two colours |
The neutrals do most of the work. On a typical page of our themes, the brand colour shows up in a handful of places: the main button, links, maybe a badge. That restraint is what makes it noticeable when it does appear.
Pick the colours in five steps
Step 1: Start from one brand colour
Take the colour from the logo or the brand guide. If there isn't one, pick the hue first (blue, green, orange) and worry about the exact shade later; the scale step fixes it. Avoid starting with a very light or very dark colour, because you'll need both directions.
Step 2: Build a scale of 11 steps
Tailwind's convention is 50, 100, 200 and so on to 950. A good scale changes lightness in even steps and lowers the saturation near both ends, so the 50 is a soft tint and the 950 isn't neon. We build ours in oklch, where equal lightness steps look equal. Our free palette generator does exactly this from one hex value and puts your colour on the step where its lightness belongs:

One colour in, a 50 to 950 scale out. The input #3e63dd landed on step 600, and the tool copies the scale as a Tailwind v4 @themeblock.Step 3: Choose a neutral with a hint of the brand
Pure grey works, but a neutral with a tiny bit of the brand's hue feels more deliberate. Tailwind ships five: slate (blue), gray (cool), zinc (a touch of violet), neutral (none) and stone (warm). Pick the one closest to your brand's temperature: a blue brand sits well on slate or zinc, an orange one on stone.
Step 4: Assign steps by contrast
This is the step that matters. WCAG asks for 4.5:1 between normal text and its background, and 3:1 for large text (about 24px, or 19px bold) and for borders of controls. We measured Tailwind v4's own blue and zinc scales against white:
Step Blue on white Zinc on white 400 2.64:1 2.62:1 500 3.76:1 4.83:1 600 5.25:1 7.72:1 700 6.83:1 10.43:1 So with white text, blue-500 fails for body text (3.76:1, enough only for large text) and blue-600 passes. Zinc-500 is the lightest grey that passes for muted text; zinc-400 is for borders and placeholder hints that aren't the only way to read something. Write those choices down as roles: primary is 600, muted text is 500, borders are 200.
Step 5: Choose the dark mode steps separately
Dark mode isn't the same steps reversed. On a near-black background (zinc-950), the numbers flip: blue-500 gets 5.29:1 and passes, blue-600 drops to 3.79:1, and blue-700 to 2.91:1. So a dark theme usually takes its primary from one or two steps lighter, with dark text on the button instead of white. We go through the code side of that in adding a colour to a shadcn theme.
Mistakes we see most
- Too many brand colours. Three equally strong colours means none of them signals "click here". Keep one for actions.
- Status colours that clash with the brand. A red brand makes error messages invisible. Shift the error colour toward crimson or the brand toward coral, so they stay apart.
- Grey text on a grey panel. Muted text that passes on white can fail on a panel. Zinc-500 on zinc-100 has less contrast than on white; check the actual pair.
- Saturated or dark backgrounds everywhere. Big fields of strong colour tire the eye and make every other element fight for attention. We keep grounds white or near-white and let photography and type carry the mood.
Turning the palette into tokens
Name colours by their job, not their hue, once they're in code: --primary, --muted-foreground, --border, --destructive. Then a rebrand changes values, not class names. That's how shadcn/ui themes work, and how every block in UI Pro picks up your palette. In Tailwind v4, adding the scale itself is one @theme block.
Questions
How many colours should a website have?
One brand colour, one neutral scale and three or four status colours covers almost every site. Count scales, not shades: a scale of 11 steps is still one colour.
What is the 60-30-10 rule?
An interior design rule of thumb: 60% dominant colour, 30% secondary, 10% accent. On websites the dominant 60% is usually white or a neutral, and the brand colour sits well under 10%. Treat it as a reminder to keep the accent small.
Should I use oklch or hex?
Either works in CSS. Build and adjust scales in oklch, where lightness behaves predictably; hand hex values to tools or people who need them. Tailwind v4's own palette is defined in oklch.
Related articles
- shadcn/uiAdd a custom colour to a shadcn/ui themeThree places in your CSS: the value in :root, the dark value in .dark, and one line in @theme inline. Plus a brand button variant and a contrast check.
- Tailwind CSS v4Tailwind v4 custom colors: how to add them, and why they don’t workAdd a --color-* variable in @theme and every colour utility follows. The four reasons a custom colour silently does nothing, each reproduced.
- Tailwind CSS v4Tailwind v4 dark mode: class toggle, system setting and fixesdark: follows prefers-color-scheme by default. One @custom-variant line switches it to a class. A no-flash toggle, and what to check when it fails.
Still stuck? We answer every message ourselves. Write to us