Skip to content

Guide

How to choose a color palette

A good interface palette is mostly gray, has one color people remember, and passes a contrast check in both light and dark mode. Here is how to build one step by step.

By Mark Stoumann ·

Most palette advice starts with the color wheel. For a website or an app it is better to start with jobs: something has to carry the brand, something has to hold the text, and something has to tell people that a payment failed. Once you know the jobs, the colors are easier to choose, and a harmony rule becomes a helper instead of the whole plan.

1. Start from one color

Pick the one color you want people to associate with the product: an existing brand color, or the hue you keep coming back to. Everything else is built around it, so it is worth choosing carefully, but it doesn’t have to be perfect yet. It will become a scale of shades, and the exact value you started from is only one of them.

In the palette generator, this is the base color. The first row is a nine-step scale of that color, and your exact value is kept as --color-1 in the CSS it produces. The scale itself is --color-1-50 to --color-1-800, at fixed lightness levels, so your base color usually falls between two of the steps rather than on one.

2. Add neutrals before more colors

Look at almost any well-designed interface and most of what you see is gray: the page background, body text, borders, dividers, disabled states. Neutrals do most of the work, which is what lets one accent color stand out. Plan a full gray scale from near-white to near-black before you add a second hue.

A gray with a hint of your brand hue often feels more finished than a pure gray. Paste a slightly tinted gray, such as #71717a, into the palette generator and choose Monochromatic: the shade scale keeps the tiny tint and steps the lightness evenly. Choose the text grays by contrast, not by eye. On white, #71717a reaches 4.83:1 and passes for body text; the lighter #a1a1aa reaches only 2.56:1, which is fine for a border but not for words. The CSS names are no help here: dark gray (#A9A9A9) is lighter than gray, and fails as text on white at 2.35:1.

3. Use 60-30-10 as a rule of thumb

The 60-30-10 rule comes from interior decorating: about 60% of a room in a dominant color, 30% in a secondary color and 10% in an accent. It has no scientific basis and no clear origin, but it captures something true: one color should dominate, and the accent works because it is rare.

Translated to a screen, the 60% is nearly always a neutral background, the 30% is surfaces, text and perhaps a muted second color, and the 10% is your brand color on the things you want clicked: primary buttons, links, the active tab. If the brand color covers half the page, it stops pointing anywhere.

4. Pick a harmony for any second color

If you need more than one hue, for illustrations, charts or a secondary brand color, a color harmony gives you hues that belong together. Each one is a fixed turn around the color wheel:

HarmonyHuesGood for
MonochromaticOne hue, several lightness levelsCalm product interfaces, neutrals, the safest start
AnalogousThe hue and its neighbors 30° each sideGradients, illustrations, a soft secondary color
ComplementaryThe hue and its opposite, 180° awayOne strong highlight, such as a call to action
Split complementaryThe hue plus 150° and 210°Contrast that is less harsh than a straight opposite
TriadicThree hues 120° apartCharts and playful brands, with one hue in the lead
TetradicFour hues 90° apartData visualization; hard to balance in an interface

The palette generator can turn the wheel in two ways, and the difference matters. Here is a triadic palette from #2563eb:

WheelColorsContrast with white
Classic (HSL)#2563eb, #eb2563, #63eb255.17, 4.22 and 1.56 to 1
Balanced (OKLCH)#2563eb, #d10e2e, #1588175.17, 5.51 and 4.60 to 1

The classic version gives the textbook hues, but its green glows at 1.56:1 and could never hold white text. The balanced version keeps every color at the same visual lightness, so all three can carry white labels. For charts and buttons that is usually the better choice; for illustrations and moodboards the classic wheel is often livelier.

5. Build shades that step evenly

Every color in the palette needs light and dark versions: a pale tint for a background, the middle for a button, a dark shade for text on that pale background. The obvious way is to change the lightness in HSL. The problem is that HSL lightness doesn’t match what we see, and the CSS Color specification itself names this as a weakness of HSL. Here is an amber, hsl(45 95% 50%), stepped in HSL, with the lightness people actually perceive measured in OKLCH:

HSL lightnessHexOKLCH lightnessVisible step
95%#fef8e697.9%–
85%#fdebb494.1%3.8
75%#fcde8390.7%3.5
65%#fbd05187.2%3.4
55%#f9c31f84.2%3.0
45%#e0a90676.5%7.7
35%#ae840463.7%12.9
25%#7c5e0349.9%13.8

Four of the eight HSL steps are crowded into the top 14 points of visible lightness, and the last two jump four times as far. The palette generator builds its scales in OKLCH instead: from 96% down to 25% lightness in nine equal steps of about 8.9 points, keeping the hue and chroma. For the same amber that gives #fef0d5 at the light end, #a47a03 in the middle and #2d1f00 at the dark end, each step looking as far from the last as the one before. Where a shade would fall outside the sRGB range a normal screen shows, the chroma is reduced until it fits, so the darkest shades of a vivid color are a little more muted.

6. Give status colors their own scales

Success, warning, error and information colors are separate from the brand. People expect error to be red and success to be green, so don’t bend them toward your brand hue; give each one its own shade scale, made the same way. Choosing them at the same OKLCH lightness makes them equally strong, so no status shouts louder than another:

RoleOn light backgroundsContrast with whiteOn dark backgroundsContrast with #18181b
Error#b6322d6.03:1#fe978b8.45:1
Warning#915b035.67:1#f0a6468.65:1
Success#107e3b5.16:1#6fd0879.32:1
Information#0267c75.57:1#85baff8.83:1

Notice the warning color: at a lightness dark enough for text on white, amber turns brown. That is why many interfaces show warnings as dark text on a pale amber background rather than amber text. And because about one man in twelve has trouble telling red from green, a status should never rely on color alone. WCAG requires a second cue, such as an icon or a word like “Error”. Our guide to designing for color blindness covers this in detail.

7. Plan dark mode with the same hues

Dark mode is not an inverted light mode. Keep the hues and pick different shades from the same scales: light text from the top of the gray scale, backgrounds from the bottom, and a lighter version of the brand color. A brand color that works on white often fails on a dark background. #2563eb has 5.17:1 against white but only 3.43:1 against #18181b, too little for normal text. The 300 shade of the same scale, #6799fd, reaches 6.37:1 there.

In CSS you can follow the system setting with the prefers-color-scheme media query, which all major browsers have supported since January 2020, or write both values in one place with light-dark(), available across current browsers since May 2024: color: light-dark(var(--color-1-600), var(--color-1-300)). It needs color-scheme: light dark on the page to work.

8. Check every pair for contrast

A palette is only finished when the combinations you actually use are readable. WCAG 2.2 asks for at least 4.5:1 for normal text, 3:1 for large text, and 3:1 for the parts of buttons, inputs and icons people need to see. Make a short list of real pairs, such as body text on the page background, white on the primary button, a link on a tinted card, and run each through the contrast checker, in both themes. When a pair fails, the checker suggests the nearest shade that passes, which is often the next step in the same scale.

If you want to know why some pretty colors fail and others pass, read how the contrast ratio is calculated. And when you are ready to write the colors into a stylesheet, HEX, RGB, HSL and OKLCH explained helps you choose the format for your design tokens.

Frequently asked questions

How many colors should a website palette have?

Fewer than most people expect: one brand or accent color, a scale of neutrals for text, backgrounds and borders, and three or four status colors for success, warning, error and information. A second brand color is optional. Each of those gets a range of shades, so the palette has many values but only a handful of hues.

Is the 60-30-10 rule a real design rule?

It is a rule of thumb borrowed from interior decorating, not a standard, and nobody has a documented origin for it. It is useful as a reminder that one color should dominate and the accent should be rare. On a website the 60% is usually a near-white or near-black neutral, not a brand color.

Why do my HSL shades look uneven?

Because HSL lightness is a formula, not a measure of how light a color looks. For a yellow at hsl(45 95%), the lighter half of the HSL scale barely changes while the darker half jumps. OKLCH lightness follows perception, so equal steps in OKLCH look like equal steps.

Should dark mode use the same colors as light mode?

The same hues, but usually different shades. A blue that passes as text on white can fail on a dark background: #2563eb has 5.17:1 against white but only 3.43:1 against #18181b. A lighter shade of the same blue, #6799fd, reaches 6.37:1 on that dark background.

Can I use a palette from a generator as it is?

Use it as a starting point. A generator gives you colors that belong together, but it does not know which one is for text, which is for buttons and which is for a warning. Assign roles, then check every text and background pair for contrast before you ship.