Software & Apps

How to Build a Consistent Website Color Palette

Turn one brand colour into a five-colour website palette: pick a base, generate matching shades, assign each colour a role, and check contrast before shipping.

Most websites look inconsistent not because their designers chose bad colours, but because the colours were chosen one at a time: a blue for the header, a different blue for the links, a grey for the footer picked by eye. Each choice is defensible alone. Together they drift.

A palette fixes this by deciding the colours as a system first: one base colour, a small set of related colours, a job for each colour, and a contrast check on the text pairs. This guide works through it with a real example — one base blue turned into a five-colour palette with FBSubNet's free Analogous Color Palette Generator, assigned to the roles a page needs, and checked for contrast before shipping.

Pick a base color

Every palette needs an anchor: the colour people already associate with the site — the brand colour from the logo, the header, or the primary button. If there is no brand colour yet, pick the colour of the most important action on the page. One base colour is enough; two competing anchors pull a design in two directions.

The worked example in this guide uses #2563EB, a medium-bright blue of the kind commonly used for links and primary buttons. It sits in the middle of the blue range: bright enough to feel like an accent, dark enough that white text on it stays readable.

A colour has three properties: hue (its position on the colour wheel), saturation (how vivid it is), and lightness (how bright or dark it is). A palette built by shifting hue while keeping the other two steady stays coordinated — that is the whole idea behind an analogous palette.

A good base colour should still read at small sizes — a colour that only works as a large block will disappear as a link or an icon — and it should be dark enough that white text on it passes a contrast check. The base blue here scores 5.17:1 against white, clearing the 4.5:1 bar for normal text. If the brand colour fails that check, it can still be the base: it works as the accent while a darker shade of the same hue carries the text.

Build supporting shades

With the base colour chosen, generate the colours that go with it. A monochromatic palette varies only lightness — safe, but flat. A complementary palette pairs the base with the colour opposite it on the wheel — lively, but easy to overdo. An analogous palette takes the colours next to the base on the wheel, the calmest option and the best default for a website.

FBSubNet's Analogous Color Palette Generator works exactly this way. Enter a base HEX colour and it returns five coordinated colours: the base in the middle, two neighbours on each side of the wheel, each 21 degrees from the last. Saturation is kept between 24% and 86% and lightness between 25% and 78%. The output for the base blue #2563EB is:

#25EBE8
#25A8EB
#2563EB
#2C25EB
#7225EB

Reading left to right, the palette moves from teal through sky blue to the base blue, then into indigo and violet. All five share the base's saturation and lightness, so they look like one family — derived from one decision, not collected from five.

Two things about this output are worth noticing. First, the generator does not invent neutrals: there is no white, black, or grey in the list, because neutrals are not derived from a hue. Second, it does not promise that every colour is safe for text — the tool page says the palette is decorative and each text combination has to be checked. Two of these five colours do fail as body text on white.

Five generated colours plus two neutrals is a good size for most small sites. Fewer, and the design reuses the accent for jobs it does not suit; more, and the palette stops being a constraint. The five colours are a starting set, not a requirement to use all five. If five feels like too many, drop the outermost colours first; the two closest to the base are the most useful.

Define UI color roles

A palette only becomes a design system when each colour has a job. Without roles, the same blue ends up as a heading on one page and a button on another. The classic split is the 60-30-10 rule: about 60% of the page is the dominant colour, usually a neutral background; 30% is a secondary colour, usually surfaces and borders; and 10% is the accent, used sparingly for links, buttons, and highlights — the colour the eye notices precisely because it is rare.

Applied to the demo palette, the roles look like this:

RoleColourWhere it is used
Page background#F8FAFCThe page canvas, behind all content
Body text#1F2937Paragraphs, headings, labels
Primary accent#2563EBLinks, primary buttons, active states
Secondary accent#2C25EBHover states, selected items, deep highlights
Decorative accent#25A8EBLarge headings, icons, illustration fills
Light accent#25EBE8Badges, chart fills, callout backgrounds
Deep accent#7225EBFooter, dark sections, special callouts
Borders and dividers#E2E8F0Card edges, table lines, input borders

The page background #F8FAFC is a near-white with a hint of blue, and the body text #1F2937 is a dark slate rather than pure black. Pure black on pure white is the highest possible contrast, but it can feel harsh on screens; this pair still measures 14.03:1 while softening the page. Borders use a light grey-blue #E2E8F0.

The two lightest palette colours, #25EBE8 and #25A8EB, are deliberately kept out of text roles. Their contrast against white is 1.49:1 and 2.67:1, far below the 4.5:1 needed for normal text, so they appear only where no reading is involved: a badge background, a chart segment, a decorative band. White text on the base blue #2563EB measures 5.17:1, which passes for normal text — so the primary button can be blue with a white label.

Write the roles down as tokens

Roles only survive if they are written down where the next person to touch the site can find them. The practical way is CSS custom properties — named variables the stylesheet uses instead of raw HEX values:

:root {
  --color-background: #F8FAFC;
  --color-text: #1F2937;
  --color-accent: #2563EB;
  --color-accent-deep: #2C25EB;
  --color-accent-light: #25A8EB;
  --color-accent-pale: #25EBE8;
  --color-accent-violet: #7225EB;
  --color-border: #E2E8F0;
}

body {
  background-color: var(--color-background);
  color: var(--color-text);
}

a {
  color: var(--color-accent);
}

.button-primary {
  background-color: var(--color-accent);
  color: #FFFFFF;
}

Named tokens do two things a list of HEX codes cannot. First, they make the role visible in the code: anyone reading var(--color-accent) knows the colour is the accent. Second, they make the palette changeable in one place — if the brand blue changes, one line changes and every link, button, and active state follows.

Check contrast before you ship

Generating a palette is not the end of the job, because a palette that looks harmonious can still be unreadable. Colour harmony is about how colours relate to each other; contrast is about how much lighter one is than another. A teal and a white can sit beautifully side by side as decoration and still be illegible as text — exactly what happens with #25EBE8 on white at 1.49:1.

The check itself is mechanical. For every pair that will carry text — body text, link text, button labels, muted text — measure the contrast ratio against the WCAG thresholds: at least 4.5:1 for normal text at level AA, 3:1 for large text, and 7:1 for normal text at AAA. FBSubNet's Two-Color Contrast Checker performs the same calculation and reports the pass or fail for each level.

Run the demo palette through it and the picture is clear:

PairRatioNormal text (AA)
#1F2937 on #F8FAFC14.03:1Pass
White on #2563EB5.17:1Pass
#2C25EB on white8.17:1Pass
#7225EB on white6.60:1Pass
#25A8EB on white2.67:1Fail
#25EBE8 on white1.49:1Fail

Three palette colours pass as text on white, two fail, and that split is the useful information: it tells you which colours may carry words and which may only decorate. Darkening a failing colour until it passes changes the hue family — a darkened teal is no longer the teal in the palette. The cleaner fix is the one in the role table above: keep the light colours for non-text jobs and let the darker members of the family do the reading. Links deserve a separate check, because a link must be readable against its background and distinguishable from the surrounding body text; a link in the base blue passes both tests, and a link in the pale teal would fail both. For more on the thresholds, see our guide on how to choose readable text and background colors.

Common mistakes

The most frequent mistake is collecting too many colours. A palette of twelve unrelated colours is not a palette; it is the absence of one. Five generated colours plus two or three neutrals is enough for most sites.

The second mistake is using a palette colour for text without checking it. Light and mid-tone colours are the usual offenders: they look strong as swatches and weak as words. The demo palette's two lightest colours fail at 1.49:1 and 2.67:1 — text in those colours on white is effectively invisible. Check every text pair, including muted text and captions.

The third mistake is forgetting the neutrals. A palette of five vivid colours with no background, text, or border colour is unusable: the vivid colours end up doing neutral jobs, and the page becomes loud.

Frequently asked questions

How many colours should a website palette have? Five generated colours plus two or three neutrals covers most small sites: a background, a text colour, a border colour, one primary accent, and one or two supporting accents.

Do I need a generator, or can I pick colours by eye? You can pick by eye, but a generator keeps the hue steps even and the saturation and lightness in a usable range — the part the eye gets wrong most often. Treat it as a starting point, not a verdict.

Can I use any palette colour for text? Only the ones that pass a contrast check against their background. In the blue demo, three of the five pass on white and two fail badly — use the passing colours for text, and keep the failing ones for decoration.

Should the palette change for dark mode? Yes, test it separately: the formula and thresholds are the same, but the pairs are different, and a colour that passes on white may fail on a near-black background.

Putting it together

A consistent website palette comes from four steps in order: pick one base colour, generate its neighbours, give each colour a named role, and check every text pair for contrast. The demo followed that order with a base blue #2563EB, producing five colours — #25EBE8, #25A8EB, #2563EB, #2C25EB, and #7225EB — and finding that two are decoration-only because they fail as text. The palette is finished not when it looks good as a row of swatches, but when every colour has a job, every text pair passes its check, and the whole set is written down as named tokens. Generate your own from your brand colour with the Analogous Color Palette Generator, and check the pairs with the Two-Color Contrast Checker before the colours reach a page.