Skip to content
All guides

A little guidance

How to check text and background color contrast in a palette

Read the Text, Background, Surface, Primary and Accent HEX values from the Color Palette Generator, see where each is used, and check every text/background pair against the WCAG 4.5:1, 3:1 and 7:1 contrast ratios.

Advertisements

Check your palette

Contrast of a six-color green palette built from #2B6A4F

We set the Primary color to #2B6A4F, chose Analogous with 6 colors and the Website preview, read the HEX values from the swatch list and calculated the contrast ratio of each text/background pair.

Color Palette Generator with Primary #2B6A4F, Analogous and 6 colors; the Website preview shows a furniture store and the swatch list reads Primary #2B6A4F, Surface #F1F4F2, Accent #55A55B, Accent 2 #97C6C9, Background #FCFDFC and Text #19241F.
Every swatch next to Preview shows its name and HEX value, the numbers you need for a contrast check. View full size
The Text swatch #19241F is selected and Preview outlines the headings, body copy and navigation that use it on the light background.
Clicking Text outlines where that color is used, so you know which backgrounds to check it against. View full size
PairColorsContrast ratioWCAG result
Text on Background#19241F on #FCFDFC15.68:1AAA for all text sizes
Text on Surface#19241F on #F1F4F214.44:1AAA for all text sizes
White button text on Primary#FFFFFF on #2B6A4F6.41:1AA for normal text, AAA for large text
Primary as text on Background#2B6A4F on #FCFDFC6.28:1AA for normal text, AAA for large text
Near-black text on Accent (used by the preview)#191110 on #55A55B6.13:1AA for normal text, AAA for large text
White text on Accent (avoid for body text)#FFFFFF on #55A55B3.03:1Large text and icons only

The tool does not display contrast ratios or AA/AAA labels. The ratios in the table were calculated from the HEX values it shows, using the WCAG 2 relative-luminance formula.

Repeat this example

  1. Set Primary color to #2B6A4F, choose Analogous and set Colors to 6.
  2. Read or copy the HEX values of Text, Background, Surface, Primary and Accent from the swatch list next to Preview.
  3. Click each swatch to see where it is used, then check each text/background pair against 4.5:1 (or 3:1 for large text).

Check the result

Text reaches more than 14:1 on both neutrals, and the Primary and Accent fills reach over 6:1 with the lettering the preview chose. Only white on Accent falls short at 3.03:1.

A common mistake

Assuming that colors from one harmony are automatically readable together. White on the Accent #55A55B looks fine at a glance but is only 3.03:1, below the 4.5:1 that normal text needs.

Check your palette

Sources and credits

Palette generated for this guide. Primary #2B6A4F with the Analogous harmony and six colors. The screenshots show the real tool and its fictional Website sample, hearth & oak.

Know the numbers you are aiming for

Contrast ratio compares the relative luminance of two colors and runs from 1:1 (identical) to 21:1 (black on white). WCAG level AA asks for at least 4.5:1 for normal body text and 3:1 for large text, which means about 24 px regular or 19 px bold and up, and for icons and input borders. Level AAA raises the text targets to 7:1 for normal text and 4.5:1 for large text. A ratio belongs to one exact pair of colors, so check each text color against each background it really sits on.

Read the pairs from the palette

Generate your palette, then look at the colors listed next to Preview. Every swatch shows its name and HEX value: Text, Background and Surface are the neutrals your copy sits on, while Primary and Accent are usually used for buttons, labels and headings. Hover a swatch and use Copy HEX to put a value on the clipboard. The tool itself does not print a ratio or an AA/AAA label, so paste each pair into a contrast checker or calculate it with the WCAG formula.

See where each color is used

Click a swatch in the list and Preview outlines every place that color appears; click it again to clear the outline. This tells you which pairs matter: in the Website sample, the Text color is outlined on the headings, body copy and navigation over the light Background and Surface. On solid Primary and Accent fills, the sample designs pick white or near-black lettering that reaches at least 4.5:1 by themselves, so read the foreground you plan to use, not just the fill.

Check dark mode and your final design

The sun and moon switch at the top right of Preview changes the neutral colors, so Text, Background and Surface get new HEX values; check those pairs again. Exported CSS and Office files keep the palette’s exact values, but your own pages may use different combinations or smaller type. Thin fonts and text over photos need more margin than the ratio alone suggests, and a color pair that only reaches 3:1 is for large text and graphics, not paragraphs.

  • Color Palette Generator

    How to create a color palette from a HEX color

    Start with one color, choose a harmony and preview the result in a document, spreadsheet or website. Follow a real six-color example.

  • Color Palette Generator

    How to download your palette as Word, Excel and CSS

    Use all three live previews and download each one in its own format. Compare real DOCX, edited XLSX and CSS files from the same six-color palette.

Advertisements