Short answer: black above a relative luminance of 0.18, white below

Black or white text on a color

Put black text on a colored background whose relative luminance is above 0.179 and white text below it: that is where the two give the same contrast. Even there the ratio is 4.58:1, so every color reaches the 4.5:1 that WCAG asks for body text with one of the two. Recolor (recolor.page) makes this choice for every swatch and shows it as a badge.

Last updated

Twelve CSS named colors, computed with culori's wcagContrast (the WCAG 2 formula) on October 8, 2026
ColorHexBlack textWhite textUse
crimson#dc143c4.21:14.99:1White, AA
tomato#ff63477.13:12.95:1Black, AAA
orange#ffa50010.63:11.97:1Black, AAA
gold#ffd70014.97:11.40:1Black, AAA
yellowgreen#9acd3211.15:11.88:1Black, AAA
seagreen#2e8b574.95:14.25:1Black, AA
teal#0080804.40:14.77:1White, AA
steelblue#4682b45.11:14.11:1Black, AA
royalblue#4169e14.33:14.85:1White, AA
navy#0000801.31:116.01:1White, AAA
rebeccapurple#6633992.50:18.41:1White, AAA
hotpink#ff69b47.93:12.65:1Black, AAA

The rule

WCAG's contrast ratio is (L1 + 0.05) / (L2 + 0.05), where L1 is the relative luminance of the lighter color and L2 of the darker; black has 0, white has 1. Against black a color gives (L + 0.05) / 0.05, against white 1.05 / (L + 0.05). The two are equal at L = 0.179. Above it black text wins, below it white.

At that point both give 4.58:1, just over 4.5:1. So for normal text at level AA there is always an answer: no color fails with both. Level AAA is stricter, at 7:1, and there is a band in between: colors with a relative luminance between 0.10 and 0.30 cannot carry normal text at AAA in either black or white.

Reading the table

Of the twelve colors above, 7 take black text: tomato, orange, gold, yellowgreen, seagreen, steelblue, hotpink. The rest take white. Some of the results surprise people who judge by eye: bright reds and oranges are lighter than they look, so black often reads better on them than white, and a mid blue sits close to the switch. That is the reason to compute the ratio instead of guessing, and to check it again whenever a palette changes.

Two hues at the same apparent strength can need different text colors, because relative luminance weights green far more than red and red more than blue. Keeping a palette accessible explains why lightness, not hue, decides contrast.

How Recolor shows it

Every swatch in Recolor prints its hex code in near-black or white, whichever has the higher contrast, and carries a small badge with a black and a white dot, each marked with a check or a cross for 4.5:1. The swatch menu spells the two ratios out. The same choice runs through the page: when a palette would push a page's text below the contrast it had, up to 4.5:1, the mapping gives lightness back, as Strength, neutral tint and overrides describes. Every page in the palette gallery has the same black and white table for its colors.

Beyond black and white

Text does not have to be black or white: a dark color from the palette on a light one, or the other way round, is fine when the pair reaches 4.5:1 (3:1 for large text, 18 point or 14 point bold). Near-black and near-white from the palette often look better than pure black and white. Buttons need two checks: their label against the button, and the button against the page at 3:1 when its edge is what shows it. Choosing the colors for those roles is covered in how many colors a website palette needs, and trying them on your own pages in test a palette on your own site.

Common questions

Does every background color work with either black or white text?

Yes, at WCAG AA for normal text: the worst case, at a relative luminance of 0.179, still gives 4.58:1 with both.

Is white text on blue always readable?

No. On dark and mid blues it is; on light blues such as sky blue, black reads better and white fails 4.5:1.

Is black text on orange better than white?

Yes, for the CSS color orange: black gives 10.63:1 and white 1.97:1.

Can I judge it by how light the color looks?

No, not reliably. Relative luminance weights green heavily and blue lightly, so compute the ratio instead.

Does Recolor check this for every swatch?

Yes. Each swatch shows whether black and white text pass 4.5:1, and the hex on it is printed in the one that reads better.

Sources