Start with the color pair people actually see

Color contrast is the difference in perceived brightness between a foreground color and its background. A heading may look clear in a design file but become difficult to read when it sits over a photograph, a gradient, or a translucent panel. Check the colors as they appear in the finished interface, not just as isolated swatches.

For ordinary text, a useful benchmark from WCAG 2.x is a contrast ratio of at least 4.5:1. Large text has a lower minimum of 3:1. In this context, “large” means at least 24 CSS pixels for regular text, or about 19 CSS pixels for bold text. These are minimum targets, not a promise that every person will find the result comfortable. Small type, thin letterforms, and long passages often benefit from more contrast.

Use a contrast checker that accepts foreground and background color values. Enter the exact colors, read the reported ratio, and compare it with the target for the text size you intend to use. If a color has transparency, check the resulting visible color against the surface beneath it. An opaque swatch tested against white will not tell you how that same swatch performs over a dark image.

Check more than body copy

Make a short inventory of the elements that carry information or invite action: headings, captions, links, navigation labels, button text, input labels, error messages, icons, borders, and focus indicators. Testing only the main paragraph color can leave the most important parts of a page hard to find or use.

For controls and meaningful graphical elements, WCAG 2.x commonly calls for at least 3:1 contrast against adjacent colors. That may apply to a button boundary, an input outline, a checkbox mark, or an icon that communicates an action. Work out which visible part lets someone identify the control or understand its state, then test that part against the color immediately beside it. Decorative shapes that convey no information need not be treated like essential icons.

Do not rely on color alone to explain a state. A red input border, for example, may be missed by someone who cannot easily distinguish that color from its surroundings. Pair it with a clear error message, and keep the message itself readable. Links within paragraphs can also benefit from an underline or another visible cue, rather than a subtle color change alone.

Test every state and surface

A control is rarely just one color combination. Buttons may have default, hover, pressed, focus, and inactive appearances. Inputs may be empty, filled, selected, or in error. Check the text and meaningful visual boundaries in each state you design. A button label that passes in its default state can fail when its background becomes lighter on hover.

Pay particular attention to text over images and gradients. The most difficult spot may be behind only one word, or on a narrow screen where the image crop changes. A solid overlay, a more consistent image area, or a separate text panel can make the contrast more dependable. Test representative screen sizes rather than assuming a desktop composition will hold everywhere.

Placeholders deserve care, too. They can provide a helpful example of the expected input, but they should not replace a persistent label. If placeholder text communicates useful information, make it readable against the input background. For intentionally inactive controls, contrast requirements may differ, but users still need a clear way to understand what is available and what they can do next.

Fix contrast without abandoning your palette

When a pair fails, change one color at a time and test again. Darkening text or lightening its background may be enough. If a pale brand color makes poor button text, try using it as the button background with darker lettering, or reserve it for larger decorative areas. The goal is not to remove personality; it is to give each color a role it can perform well.

Build a small set of reusable color pairs instead of adjusting every component independently. Define combinations for body text, muted supporting text, links, primary buttons, borders, and status messages. Check each pair on the surfaces where it will actually appear. Reuse makes later edits easier and reduces the chance that a one-off color slips through.

Finally, look at the page at a normal reading distance and navigate it with a keyboard. Automated ratios are valuable, but they do not reveal every practical problem: a focus ring may be hidden behind another element, or a tiny label may still feel strained despite passing its numerical target. Combine measured checks with a careful review of the complete design.

Back to category ↗