Accessible colour palettes: how to build and check one with WCAG 2.2

15 min read

  • Colour
  • WCAG

An accessible colour palette is a set of colours that you only use in pairs that pass WCAG’s contrast rules. No colour passes or fails by itself. It passes against what sits next to it.

So list the pairs your palette allows, and measure each one. Then add a cue other than colour wherever colour carries meaning.

In short

  • Text needs 4.5:1 against its background. Large text needs 3:1.
  • Buttons, borders, icons and focus rings need 3:1. That’s measured against the colours right next to them.
  • Give each hue lighter and darker steps. Then every colour has a text pair and a background pair that pass.
  • Colour can’t be the only signal. Add text, an icon or a shape as well.

An accessible colour palette is a set of colour pairs that people can tell apart. WCAG 2.2 doesn’t rate single colours. It measures the contrast ratio between two colours, from 1:1 for no difference up to 21:1.

A contrast ratio compares how light two colours are, and every checker works it out for you.

Black text on white is the worked example. It measures 21:1, the top of the scale, so it passes every text rule.

The same colour can pass in one pair and fail in the next. GOV.UK’s brand blue #1d70b8 measures 5.169:1 on white, so it works as text there. On its own pale tint #d2e2f1 it drops to 3.911:1, which is too low for body text. So a palette is really a list of pairs, and each pair gets its own check.

How an issue shows up in our reports

Criterion
1.4.3 Contrast (Minimum)
Where
Body text
Status
To fix

Download a sample report →

Text and its background need a contrast ratio of at least 4.5:1. Large text needs at least 3:1. That’s 1.4.3 Contrast (Minimum), a Level AA rule in WCAG 2.2. It covers text and images of text. So a “WCAG compliant” colour is really a pair that meets these ratios.

The 4.5:1 figure isn’t random. W3C chose it to make up for the drop in contrast that comes with mild sight loss, about 20/40 vision. For Level AAA, 1.4.6 Contrast (Enhanced) uses 7:1.

What counts as large text

Large text is at least 18 point, or 14 point bold. Those are W3C’s figures.

Some guides give different pixel sizes. The US Web Design System (USWDS) gives “19px+ bold or 24px+ normal text”. For bold text, 19px is a little stricter than W3C’s figure, so use 19px. Guides that put large text at 18px are wrong, and so are guides that count any bold text as large.

What the text rule leaves out

Three kinds of text have no contrast rule. One is text in a control that’s turned off, like a greyed-out button. Another is pure decoration, or text in a photo with lots else going on. The last is text that’s part of a logo or brand name.

That logo rule is narrow. W3C says text that fails because of brand guidelines isn’t exempt, except in logos and logotypes. So a brand colour that fails as text can’t be used for headings or links just because the brand book says so.

Placeholder text isn’t exempt either. W3C says the rule “applies to text in the page, including placeholder text”. So the grey hint inside a form field needs 4.5:1, unless it’s large text. Some guides put placeholders at 3:1, which only works for large text.

No rounding at the line

A ratio has to reach the number, not round up to it. W3C’s example is 4.499:1, which doesn’t meet 4.5:1. The same goes for 2.999:1 and the 3:1 line.

The parts that show a control is there need 3:1 against the colours next to them. So do the parts that show its state, such as selected or focused. That’s 1.4.11 Non-text Contrast, also at Level AA. It covers borders, icons, ticks and focus rings, plus the parts of a chart you need to understand it.

Text inside a button still follows the text rule. Only the non-text parts take 3:1.

Icons count too. A status icon with no text next to it needs 3:1. So does each line in a graph against its background.

Turned-off controls are exempt here as well. So are controls whose look comes from the browser and hasn’t been changed.

Adjacent colours

Adjacent colours are the colours that touch the part you’re checking. For a text input with a white inside, a dark border and a white page around it, the border is checked against the white page.

A border only has to pass when it’s what shows the control is there. If the text or an icon already shows the button, the button needs no border at all. W3C’s passing example is a text input with a grey #767676 border on white.

Some parts sit inside the control, like the tick in a checkbox. Then the adjacent colour can be another part of the control.

States and focus colours

A control’s states don’t need 3:1 against each other. Hover and visited colours can be close to the default. But no state can lose contrast with the colours around the control.

Focus rings are the one most palettes forget. A custom focus ring needs 3:1 against the colours next to it. W3C passes a grey #949494 ring on white at 3:1. It fails a grey #AAA ring on white at 2.3:1.

GOV.UK’s palette gives focus its own colour, yellow #ffdd00, with #0b0c0c for text on it. That text pair measures 14.545:1. The yellow against white measures 1.346:1, so on a white page the yellow can’t be the part that shows focus. Something darker next to it has to carry the 3:1. That’s a fact about the pair. GOV.UK’s colour page doesn’t describe the shape of its focus style, so it’s not a verdict on GOV.UK.

For testing focus on a live page, see keyboard accessibility testing.

No colour is best for accessibility, because WCAG doesn’t list colours. W3C says colour vision varies so much that it can’t prescribe colour pairs. So the rules measure lightness instead. Any two colours with enough difference in lightness pass, whatever their hue. Dark on light and light on dark both work.

That’s also why hue matters less than you’d think. Hue and saturation have little or no effect on reading for people with colour vision deficiency. The difference in lightness is what counts.

Black on white is the highest contrast you can get, at 21:1. But two US government sources advise against pure black text on white. USWDS says avoiding it “helps dyslexia, Irlen Syndrome, light sensitivity, and autism”. digital.gov says to “slightly temper the contrast”, because stark contrast can blur text for people with Irlen syndrome.

WCAG sets minimums, not a maximum. W3C also says some people with cognitive disabilities need low contrast, so it encourages letting users change colours. So meet the minimums, and don’t treat maximum contrast as right for everyone.

You don’t need to avoid any colour. You need to avoid pairs that miss the ratios, and signals that rely on colour alone. Light grey on white and yellow on white are the common failures. But a darker shade of the same hue often passes, so test the pair before you drop the colour.

Yellow shows how this works. W3C’s own example puts yellow #FFF000 against white at 1.2:1. GOV.UK’s primary yellow #ffdd00 fails on white, as the focus section shows. Its shade-25 #bfa600 measures 2.422:1, which fails too. But its shade-50 #806f00 measures 5.010:1 on white, which passes as body text. So “yellow never works on white” is true for bright yellows, not for every yellow.

Start from the jobs your colours do, such as text, links, borders, focus and errors. Give each hue lighter and darker steps. Then measure every pair you plan to use, and write down the ones that pass. The palette is that list of allowed pairs, not the swatches.

Start from the jobs your colours do

GOV.UK’s palette names its colours by job. There’s text, secondary text, link, link hover, border, input border, focus, error and success. Each one has a fixed hex value.

That makes the pairs easy to see. Text goes on the page background, and links go on the page background too. Error text goes on white. Each of those is one pair to measure.

Build tints and shades for each hue

Most GOV.UK colours have tints at 25%, 50%, 80% and 95%, and shades at 25% and 50%. The pale steps can be backgrounds. The dark steps can carry text.

Here’s GOV.UK’s blue group, measured against white and against GOV.UK’s black #0b0c0c.

Build tints and shades for each hue
GOV.UK blue Hex Against white #ffffff Against black #0b0c0c
Tint 95% #f4f8fb 1.067:1 18.343:1
Tint 80% #d2e2f1 1.321:1 14.820:1
Tint 50% #8eb8dc 2.091:1 9.364:1
Tint 25% #5694ca 3.238:1 6.048:1
Primary #1d70b8 5.169:1 3.788:1
Shade 10% #1a65a6 6.076:1 3.223:1
Shade 25% #16548a 7.867:1 2.489:1
Shade 50% #0f385c 12.065:1 1.623:1

Read the table as pairs. The three palest tints fail on white, but they carry black text at well over 4.5:1, so they work as backgrounds. Tint 25% passes 3:1 on white, so it can be a border or an icon, but not body text. From the primary down, every step carries body text on white, and white text on it. So one hue gives you background colours, a border colour and text colours.

USWDS does this with numbered grades. USWDS gives its colours grades. Its grey family runs from grade 5 to grade 90. The gap between two grades is its “magic number”. A gap of 50 or more gives WCAG 2.0 AA contrast. That only works for USWDS’s own colours, because each grade sits in a set range of lightness. For any other colour, measure the pair.

Brand colours that fail as text

Many brand colours are too light for text on white. GOV.UK’s orange #f47738 measures 2.784:1 on white, so it fails as text there. Turn the pair round and it works. GOV.UK’s black #0b0c0c on that orange measures 7.035:1.

You keep the brand colour and change what goes on it.

Greys, placeholder and disabled text

Greys do a lot of work in a palette, so check each one by job. GOV.UK’s secondary text grey #484949 measures 9.033:1 on white, which is fine for any text. Its grey #858686 measures 3.651:1. That passes 3:1, so it can mark the edge of a control, but it fails 4.5:1. So it can’t be placeholder text unless that text is large.

Disabled text is different. A turned-off control has no contrast rule. But placeholder text does, so don’t give the two the same grey just because both look faint.

Write down the pairs you allow

A palette stays accessible when people know which pairs they can use. Write each allowed pair next to the swatches, with its ratio and the job it’s for. Mark the pairs that only pass for large text or for borders. Then a new page doesn’t need a new check for every colour.

GOV.UK’s Design System publishes its full colour palette with hex values, so it’s a real palette you can check. Its colour page doesn’t state ratios or list these pairs. Each ratio below was measured with a WCAG 2.2 contrast checker, pairing colours by the jobs the palette gives them.

Accessible colour palette examples: GOV.UK’s colours, measured
Pair (GOV.UK’s names) Colours Ratio Passes
Text on body background #0b0c0c on #ffffff 19.587:1 Text

| Secondary text on white | #484949 on #ffffff | 9.033:1 | Text |

| Visited link on white | #54319f on #ffffff | 9.063:1 | Text | | Error on white | #ca3535 on #ffffff | 5.157:1 | Text | | Success on white | #0f7a52 on #ffffff | 5.349:1 | Text |

| Focus text on focus | #0b0c0c on #ffdd00 | 14.545:1 | Text |

| Border on white | #cecece on #ffffff | 1.573:1 | Neither |

Every text pair here clears 4.5:1. The two that fail are the focus yellow and the light border on white. Neither of those is a text colour. The light border only needs 3:1 where it’s what shows a control is there. GOV.UK’s input border is #0b0c0c, which measures 19.587:1 on white.

GOV.UK also says “Always use the GOV.UK colour palette”. So treat this as a worked example to learn from, not a palette to copy for another brand.

Colour can’t be the only way you show meaning. That’s 1.4.1 Use of Color, a Level A rule. It says colour mustn’t be the only visual way to give information, show an action, ask for a response or set one thing apart from another. So add text, an icon or a pattern as well. That’s what makes a palette work for people with colour blindness.

The rule doesn’t ban colour, or even colour coding, as long as something else backs it up. A form that marks required fields in red also needs an icon or a word. An error shown only by a red border fails.

Two colours that are 3:1 or more apart in lightness count as a second cue. But if people have to tell one particular colour from another, you still need another cue, whatever the ratio.

Red-green colour vision deficiency is the most common form. MedlinePlus Genetics says it affects about 1 in 12 men and 1 in 200 women among people with Northern European ancestry. For the types, the colour pairs that clash and how to simulate them, see colour blindness and accessible design.

Measure every pair you plan to use with a contrast checker, and compare each ratio to the minimums above. A grid that shows all your pairs at once is quickest for a whole palette. Then look at your designs in greyscale to spot anything that relies on colour alone.

W3C’s Easy Checks give three ways to check contrast. Each has a weakness.

  1. Use a table of contrast ratios to see every pair at once. ↳ It’s thorough, but it can list pairs that never appear together.
  2. Use an eye-dropper to pick a text colour and a background colour. ↳ It’s accurate, but it checks one pair at a time.
  3. Turn the colour off and look at the page in greyscale. ↳ It shows you what’s lost, but it gives no ratio.

For a palette, digital.gov names two tools that test every pair at once, the Accessible Color Palette Builder and Contrast Grid. For a single pair it names WebAIM’s Color Contrast Checker. None of the three has been tested for this page. Some tools call themselves accessible colour palette generators. Whatever a tool makes, check the pairs it gives you with a contrast checker before you use them.

If you work in Figma, this round-up of Figma accessibility plugins covers palette builders as well as checkers.

Some palette tools also show an APCA score, a different way to measure contrast. What is APCA? explains it.

For free checkers and browser tools, see accessibility testing tools. To check contrast on a live page, see how to test website accessibility. The colour checks an audit runs are in the accessibility audit checklist.

Accessibility Testing runs accessibility audits that end in a written audit report against WCAG 2.2 AA.

If you build the palette in code, name colours by their job and use those names everywhere. GOV.UK tells its users “Do not copy the specific hexadecimal (hex) colour values”. It gives Sass functions instead, so a service picks up palette changes when it updates. USWDS works the same way with design tokens.

Tokens also keep your list of allowed pairs in one place. If a colour changes, you measure its pairs again once.

USWDS adds one more step. It says the best option, when you can, is to let users choose their own text and background colours. W3C’s Easy Checks say pages need to work when people change those colours in the browser.

Whether WCAG is a legal duty depends on where you are and who you are. For the UK, see UK accessibility law. For the US, see ADA website compliance.


I've designed products for more than ten years, leading accessibility and design system work for product teams. I also built Perception, a Figma plugin that checks contrast while you design.

Sources

Talk to us about an audit

Book a 25-minute call and tell us what you need checked.

Book a 25-minute call