SpunkArt
Color, art and images

How to choose a color palette for a website or brand

A working web palette is a small set of named roles, not a pile of favourite colors. This guide builds one step by step, with every HEX value written out and every text pairing checked.

Start with roles, not colors

Before you pick any HEX code, list the jobs colors must do on the site. Most sites need the same handful:

  • Primary: links, main buttons, the color people remember.
  • Accent: rare highlights such as a badge or one key button.
  • Text: a dark neutral for body copy.
  • Surface: a light neutral for page and card backgrounds.
  • Muted: secondary text, borders, captions.
  • Status: error, warning and success, if the site has forms or alerts.

Write the palette as a table of roles. Then the question “what color is a disabled button?” has an answer that stays the same on every page.

An example palette

The values below are an example, not a recommendation. Ratios are computed with the WCAG formula and rounded to two decimals.

RoleHEXAgainst whiteAgainst #f6f5f4
Primary#1a5fb46.29:15.77:1
Accent#e661003.46:13.17:1
Text#241f3115.97:114.66:1
Muted#5e5c646.58:16.04:1
Surface#f6f5f41.09:1–

Reading the table tells you how each color may be used. The primary blue and the muted grey pass 4.5:1 for body text on both backgrounds. The orange accent does not, so it works as a button fill with dark text on it (the accent against #241f31 is 4.62:1) or as large display text, but not for small links.

Tints and shades from one color

You rarely need a second blue. Instead, make lighter tints by mixing the primary with white, and darker shades by mixing it with black. Each channel moves in a straight line:

tint = color + (255 − color) × t
shade = color × (1 − t)
tTint of #1a5fb4Shade of #1a5fb4
0.2#487fc3#154c90
0.4#769fd2#10396c
0.6#a3bfe1#0a2648
0.8#d1dff0#051324

How one cell is worked out. The 0.4 tint, red channel: 26 + (255 − 26) × 0.4 = 26 + 91.6 = 117.6, which rounds to 118, or hex 76. Green: 95 + 160 × 0.4 = 159, hex 9f. Blue: 180 + 75 × 0.4 = 210, hex d2. Result #769fd2.

Use the pale tints for hover backgrounds and selected rows, and a dark shade for the hover state of a primary button.

The 60-30-10 split

An old interior-design rule of thumb works well on screens: about 60% of the visible area in the dominant color (usually the surface neutral), about 30% in a secondary color (text, panels, a header band) and about 10% in the primary and accent. It is a guide for balance, not a rule to measure with a ruler. Its main lesson is that the brand color should be the rare one.

Step by step

  1. Pick one primary you are happy to see on every page.
  2. Pick near-neutrals for text and surface. Tinting them very slightly toward the primary’s hue makes the set feel related.
  3. Choose an accent, often from the complementary or split-complementary hues.
  4. Generate three or four tints and shades of the primary.
  5. Check every text-on-background pair you will actually use, including white text on the primary button.
  6. Write the final values down as CSS custom properties, for example --color-primary: #1a5fb4;, and use only those names in your styles.

Common mistakes

  • Too many near-duplicates. Five slightly different blues across a site look like errors, not variety.
  • Pure black text on pure white. It passes, but a soft dark neutral is often easier on the eye for long reading.
  • Status colors that rely on hue alone. Red and green errors look alike to many people with color vision deficiency. Add an icon or a word.
  • Forgetting dark mode. If you offer one, plan its surface and text values now, and check the pairs again.

Questions people ask

How many colors should a palette have?

Count roles, not hues. One primary, one accent, three or four neutrals and a few tints is enough for most sites.

Can I take colors from a photo or painting?

Yes. Sample a few areas, then treat them as candidates for roles and run the same contrast checks. Colors that look rich in a picture often need darkening before they work as text.