Color Contrast: The Decisions That Matter
A practical checklist for color contrast: the WCAG thresholds, text over images, UI boundaries, dark schemes, component states and recording approved pairings.
On this page
- 1. Know the Color Contrast Thresholds and How the Ratio Works
- 2. Check Contrast While Choosing Colors, Not After Building
- 3. Decide How Failing Brand Colors Will Be Used
- 4. Make Secondary and Placeholder Text Readable
- 5. Test Text Over Images at the Worst-Case Area
- 6. Check Interface Boundaries, Icons and Graphics at 3:1
- 7. Check Light and Dark Schemes Independently
- 8. Check Every State, Including Disabled
- 9. Record Approved Accessible Color Pairings
- 10. Verify in the Browser and Prevent Regressions
- Working on something like this?
Color contrast is the measurable difference in luminance between a foreground, such as text, an icon or the border of a form field, and the background behind it. The Web Content Accessibility Guidelines (WCAG) turn that difference into a ratio and set minimum thresholds that content must meet. It sounds like a narrow technical rule, but it decides whether a large share of your audience can read your site at all: people with low vision, people with color vision deficiencies, older readers whose contrast sensitivity has declined, and anyone reading a phone outdoors in bright sunlight.
Contrast is also the single most commonly failed accessibility criterion, which is frustrating because it is entirely checkable at design time. Unlike keyboard support or screen reader behavior, contrast does not require a built product to test. Two hex values and a calculator are enough. That makes it one of the cheapest accessibility problems to prevent and one of the most tedious to fix after launch, when a failing gray has been copied into hundreds of components, templates and marketing pages.
This guide is written for designers choosing palettes, developers implementing themes, marketers producing campaign pages and the business owners who sign off on brand guidelines. It starts with a master checklist, then works through each item: why it matters, what the standard actually requires, and how to do it well in practice, with worked numbers you can reproduce.
- Know the thresholds: 4.5:1 for normal text, 3:1 for large text and for non-text elements, 7:1 for AAA normal text.
- Check contrast while choosing colors, not after building.
- Decide how brand colors that fail will be used before they reach templates.
- Make secondary, helper and placeholder text meet 4.5:1.
- Test text over images at the worst-case area of the image, and use a scrim where needed.
- Check interface component boundaries, icons and meaningful graphics at 3:1, not only text.
- Check light and dark schemes independently.
- Check every state: hover, focus, visited, error and disabled.
- Record approved accessible color pairings and make them the default.
- Verify in the browser and guard against regressions.
1. Know the Color Contrast Thresholds and How the Ratio Works
Every other item on this checklist depends on understanding what is being measured. WCAG defines contrast ratio using relative luminance, a measure of how bright a color appears, weighted for human vision. Green contributes most to perceived brightness, red less and blue least. The formula converts each sRGB channel to a linear value, combines them as roughly 0.2126 red, 0.7152 green and 0.0722 blue, and then compares the lighter color to the darker one as (L1 + 0.05) divided by (L2 + 0.05). The result runs from 1:1, where the colors are identical in luminance, to 21:1, which is black on white.
You do not need to calculate this by hand, but knowing its shape helps. Because hue is weighted so unevenly, a saturated yellow and a saturated blue that feel equally strong can have wildly different luminance. Contrast is about lightness, not about how different two colors look in hue. Red text on a green background can look vivid and still fail badly.
The thresholds that apply
The W3C's guidance on contrast minimum and the related success criteria sets the following levels, which most accessibility laws and procurement policies reference at Level AA:
| Content | Level AA | Level AAA | Notes |
|---|---|---|---|
| Normal text | 4.5:1 | 7:1 | Body copy, labels, links, helper text, placeholder text |
| Large text | 3:1 | 4.5:1 | At least 18pt, or 14pt bold |
| UI components and meaningful graphics | 3:1 | Not separately raised | Field borders, toggles, icons, chart lines, focus indicators |
| Logos and incidental text | Exempt | Exempt | Brand marks, pure decoration, text in inactive components |
What counts as large text
Large text is defined as 18 point, or 14 point bold. On the web, a point converts to roughly 1.333 CSS pixels, so 18pt is about 24px and 14pt bold is about 18.66px at a weight of 700 or heavier. A 20px semibold heading is therefore not large text under the definition, and must meet 4.5:1. Designers often assume anything that looks like a heading qualifies for the relaxed threshold. Check the actual size and weight.
No rounding up
Thresholds are minimums. A ratio of 4.48:1 does not pass 4.5:1, even though a tool might display it as 4.5. This matters in practice: #767676 on white is 4.54:1 and passes, while #777777, one step lighter, is 4.48:1 and fails. When a tool reports a borderline value, look at the unrounded figure.
What is exempt
Logos and text that is part of a brand mark are exempt, as is incidental text: text in inactive user interface components, text that is pure decoration, text that is not visible to anyone, and text that is part of a picture containing significant other visual content, such as a sign in the background of a photo. The exemptions are narrow. A promotional banner where the text is the message is not incidental just because it sits on an image.
Tip: Memorize three reference grays against white: #767676 at 4.54:1 is roughly the lightest gray that passes for normal text, #949494 at 3.03:1 is roughly the lightest that passes for large text and component borders, and #595959 at 7.0:1 meets AAA. Anything lighter than these for the matching use is a red flag you can spot without a tool.
2. Check Contrast While Choosing Colors, Not After Building
The most effective contrast practice costs almost nothing: check every pairing at the moment a color is chosen. A palette decided in a brand workshop, or a gray picked in a design tool because it looked elegant on a high-end monitor, becomes very expensive to change once it has been implemented as a design token, used in a component library, baked into email templates and printed into brand guidelines.
How to do it in practice
- Build contrast into the palette file. For each color, list its ratio against the page background, the main surface colors and pure white and black. Most design tools have plugins that display this live.
- Define pairings, not just colors. A color is not accessible or inaccessible on its own. It is accessible against a specific background at a specific size. Specify which foregrounds are approved on which backgrounds.
- Design on realistic screens. Wide-gamut, high-brightness monitors make low-contrast grays look more legible than they will on an average laptop, a budget phone or a projector. Check designs on at least one ordinary display.
- Review contrast in design critique. Make it a standing checklist question alongside layout and copy, so it is caught before handoff.
Deque University's guidance on color contrast covers the practical testing side, including how to handle gradients, transparency and text over images, which are the cases where design-time checks most often go wrong.
Transparency and opacity
If text is set with reduced opacity, such as a 60 percent black or a white at 70 percent over a colored surface, the color that matters is the blended result, not the nominal color. Calculate contrast against the actual rendered color, and be aware that the same semi-transparent text will produce different ratios on every background it lands on. Solid colors are easier to verify and to keep verified.
3. Decide How Failing Brand Colors Will Be Used
Many brand palettes were designed for logos, print and packaging, not for text on screens. Bright oranges, yellows, light greens, cyans and pinks frequently fail against white, and white text on them fails too. This is the point where the key trade-off in contrast work shows up: do you adjust the brand color for digital use, or keep it exact and restrict where it can appear?
A worked example with a brand orange
Consider a brand whose primary color is a vivid orange, #FF6600, and whose designers want to use it for buttons with white labels and for links in body text.
- White on #FF6600 measures 2.94:1. It fails 4.5:1 for normal text and narrowly fails even the 3:1 large-text threshold.
- #FF6600 text on a white page is the same 2.94:1, so orange links in body copy fail.
- Black on #FF6600 measures 7.15:1, which passes AA and even AAA for normal text.
- A deeper burnt orange, #C2410C, carries white text at 5.18:1 and works as link text on white at the same ratio.
So the brand has three workable options. It can keep #FF6600 for buttons but set the labels in black or a very dark color. It can introduce a darker companion shade, such as #C2410C, for interactive and text uses while keeping #FF6600 for large decorative areas, illustrations and the logo. Or it can use #FF6600 only where contrast requirements do not apply, and pick a different accent for interactive elements. Each has consequences for how the brand feels on screen.
Pros
- Adjusting the brand color, or adding an accessible companion shade, lets the brand stay recognizable in buttons, links and headings.
- A defined digital shade removes ambiguity for every future designer and developer.
- The fix happens once, in the palette, instead of repeatedly in individual components.
- Black or dark labels on the original color often preserve the color exactly while still passing.
Cons
- A darker companion shade looks different from the print color, which some brand owners resist.
- Restricting the original color to decoration can make digital properties feel less on-brand.
- Dark text on a bright color changes the visual character of buttons and may conflict with existing guidelines.
- Every option requires updating brand guidelines, which means stakeholder time and sign-off.
Finding a passing shade that still feels on-brand
When a brand color needs a darker or lighter companion, change lightness first and keep hue as close to the original as possible. Working in a perceptual color model, such as LCH or OKLCH, makes this easier than adjusting hex or RGB values directly, because you can lower lightness while holding hue steady and watch the ratio climb. Step down in small increments, measure at each step, and stop at the first value that clears the threshold with a small margin, for example 4.6:1 rather than exactly 4.5:1, so minor rendering differences do not tip it into failure. Saturation often needs a slight increase as lightness drops, or the darker shade can look muddy. Put the original and the candidate side by side at real sizes, in real components, before presenting it to brand owners. A companion shade judged as an isolated swatch is usually rejected; the same shade seen on a finished button usually is not.
In most cases the best answer is a documented digital extension of the palette: the original color stays for the logo and large decorative surfaces, and one or two tested shades are approved for text and interactive use. When brand colors genuinely cannot meet requirements, or a palette has to be extended accessibly without losing its character, it is worth bringing in specialist help, because the work is as much about brand negotiation as about math.
4. Make Secondary and Placeholder Text Readable
Gray text is where most contrast failures live. Timestamps, captions, helper text under form fields, breadcrumbs, footer links, metadata on product cards and placeholder text inside inputs are routinely set in light grays because they are considered secondary. Secondary is a hierarchy decision, not an exemption. If the text conveys information, it needs 4.5:1 at normal sizes.
Placeholder text in particular
Browser default placeholder styling and many UI kits use very light grays. A common value such as #999999 on white measures 2.85:1, and #9CA3AF, a popular gray in utility frameworks, measures 2.54:1. Both fail. Placeholder text is not exempt from contrast requirements, and it carries extra risk: some teams use it in place of a visible label, so if it cannot be read, the field has no readable instruction at all. The robust pattern is a persistent visible label above the field, with any placeholder used only for an example value, set in a gray that passes 4.5:1.
Creating hierarchy without failing contrast
You can still de-emphasize text while passing. Use size, weight, spacing and position before resorting to lighter color. When you do use color, use grays that sit between the passing threshold and the body text color. On white, for instance, body text might be near-black, secondary text #6B7280 at 4.83:1, and anything lighter reserved for non-text decoration such as dividers. Three levels of text emphasis are usually enough, and all of them can pass.
5. Test Text Over Images at the Worst-Case Area
Hero banners, campaign pages, video overlays and product cards with text on photography are the hardest contrast cases because the background is not one color. A headline might sit on a dark sky at one end and a bright cloud at the other. Contrast must hold across the whole area behind the text, which means checking the worst-case area of the image, not the average or the part the designer happened to sample.
How to check
- Identify every region the text overlaps at every breakpoint. Responsive cropping moves text over different parts of the image on phones, tablets and desktops.
- Sample the lightest area behind light text, or the darkest behind dark text, including small highlights that fall behind individual letters.
- Measure the text color against that worst-case sample.
- If it fails, change the treatment rather than hunting for a different sample point.
Treatments that work
- Scrims. A semi-transparent dark or light overlay, or a gradient behind the text area, reduces the image's range. Text over photography with no scrim is one of the most common failures on marketing pages.
- Solid text containers. A panel or band of solid color behind the text makes contrast predictable and easy to verify.
- Image selection and art direction. Choose or crop images with a calm, even area where text will sit, and brief photographers to leave that space.
- Text shadows and outlines. These can help, but they are harder to evaluate against the standard, so pair them with another treatment rather than relying on them alone.
A worked scrim check
Suppose white headline text sits over a product photo whose brightest area behind the letters samples at about #B3B3B3. White against that gray measures only 2.1:1, which fails even the large-text threshold. A black overlay at around 50 percent opacity darkens that area to roughly #5A5A5A, and white text against it clears 4.5:1 with room to spare. The darkest parts of the image get darker too, which is harmless for white text. The same process works in reverse for dark text on a light image with a white overlay. Record the overlay value in the component specification so it is not quietly reduced later for aesthetic reasons.
Tip: For content management systems where editors upload their own hero images, build the scrim into the component so it is always present, rather than trusting each editor to choose a suitable image. A template that guarantees contrast is far more reliable than a guideline that asks for it.
6. Check Interface Boundaries, Icons and Graphics at 3:1
Contrast is not only about text. WCAG's non-text contrast requirement asks for at least 3:1 for the visual information needed to identify user interface components and their states, and for parts of graphics required to understand the content. Teams that check only text regularly ship interfaces that are technically readable but impossible to operate for some users.
What to check
- Form field boundaries. An input defined only by a very light border, for example #E5E5E5 on white at 1.26:1, may be invisible to many users. If the border is the only thing that shows where the field is, it needs 3:1 against the adjacent background.
- Checkboxes, radio buttons and toggles. Both the control outline and the indication of its state, checked or on, need to be perceivable.
- Icons that carry meaning. A search, close or menu icon with no text label must meet 3:1.
- Focus indicators. The visible focus ring must contrast with the colors around it.
- Charts, maps and diagrams. Lines, bars, map regions and legend keys needed to understand the data should meet 3:1 against their neighbors, and should not rely on color alone.
Our guide to non-text contrast for controls goes deeper on component-level decisions, and accessible maps covers the particular problems of color-coded regions and routes.
Where the requirement does not apply
Components whose boundaries are not needed to identify them, such as a button with a clear text label where the button background is decorative, do not require their background to meet 3:1 against the page. The label text still needs 4.5:1 against the button. This distinction lets designers use subtle, low-contrast button backgrounds, provided the component is still identifiable by its text and position.
7. Check Light and Dark Schemes Independently
A dark scheme is a second palette, not an inversion of the first, and it needs its own contrast checks. Assuming a dark scheme passes because the light one does is one of the most common errors in theming work. Colors that pass comfortably on white can fail on dark gray, and vice versa.
Worked example: one blue, two backgrounds
Take a link blue, #0070C0. On white it measures 5.15:1 and passes. Placed on a typical dark surface such as #121212, the same blue measures 3.64:1 and fails for normal text. The dark theme needs a lighter blue, such as #4DA3FF, which measures 7.14:1 on #121212. The same pattern applies to status colors: the red, green and amber used for errors, success and warnings almost always need lighter variants in a dark scheme.
| Pairing | Ratio | Normal text AA | Large text and UI AA |
|---|---|---|---|
| #0070C0 on white | 5.15:1 | Pass | Pass |
| #0070C0 on #121212 | 3.64:1 | Fail | Pass |
| #4DA3FF on #121212 | 7.14:1 | Pass | Pass |
| #3B82F6 with white text | 3.68:1 | Fail | Pass |
| #1D4ED8 with white text | 6.70:1 | Pass | Pass |
| #9E9E9E on #121212 | 6.99:1 | Pass | Pass |
Practical guidance for dark schemes
- Define dark-scheme tokens separately and test every pairing, rather than generating them automatically and assuming they pass.
- Very dark grays are often preferred to pure black for surfaces, and slightly off-white text to pure white, because extreme contrast can feel harsh to some readers. Both choices still pass easily.
- Elevated surfaces in dark themes, such as cards and dialogs, are often lighter than the page. Check text against each surface level, not only the base background.
- Test with forced colors and operating-system high contrast modes too, which override your palette entirely. Our practical guide to forced colors and high contrast mode covers what survives and what breaks.
Material Design's guidance on accessible color is a useful reference here, because its color system builds light and dark schemes from tonal palettes, which makes it easier to reason about which tones will contrast with which surfaces in each scheme.
8. Check Every State, Including Disabled
Components change color as users interact with them, and each state is a new pairing that needs checking. Designers often verify the default state carefully and then pick hover, pressed, selected and error colors by eye.
Hover, pressed and selected
If a button darkens on hover, the label must still pass against the hover color. If a selected tab is indicated only by a color change, the difference between selected and unselected needs to be perceivable, and ideally supported by a non-color cue such as an underline or weight change.
Links in body text
Where links are distinguished from surrounding text by color alone, WCAG's use-of-color requirement comes into play as well as contrast. A common approach is to underline links, which removes the problem. If links are not underlined, the link color needs at least 3:1 against the surrounding body text in addition to 4.5:1 against the background, plus a non-color cue on hover and focus. Meeting both at once constrains the palette considerably, which is why underlines are the simpler choice.
Focus
Focus indicators must be visible against every background they appear on, including dark bands, image headers and colored cards. A single focus color that works on white may disappear on a brand-colored section. Pair visible focus styling with a logical sequence, as covered in our guide to focus order with CSS layout.
Error and status messages
Red error text is frequently too light. A red that passes on white may fail on a pale pink error background. Check the actual message against the actual container, and do not rely on red alone to indicate an error; pair it with an icon and explicit text.
Disabled states
WCAG exempts inactive components from contrast requirements, so a disabled button does not have to meet 4.5:1. That does not mean it should be invisible. Disabled states so faint that they cannot be read at all leave users unable to tell what the control is or why it is unavailable. Keep disabled labels legible enough to read, explain nearby why the action is unavailable where possible, and consider whether the control should be disabled at all rather than allowing the action and showing a clear error.
Warning: The exemption for inactive components applies only to controls that are genuinely disabled. Styling an active control in faint gray to de-emphasize it, such as a secondary Cancel button or a less-promoted plan option, does not make it exempt. If a user can interact with it, it must meet the thresholds.
9. Record Approved Accessible Color Pairings
Once pairings have been tested, write them down and make them the easiest option. Contrast failures return when each new designer or developer picks colors afresh, when marketing produces a campaign page outside the design system, or when a third-party widget brings its own styles.
What a pairing record includes
- The foreground token and value, the background token and value, and the measured ratio.
- What the pairing is approved for: normal text, large text only, or non-text only.
- The scheme it applies to: light, dark, or both.
- Any restrictions, such as minimum size or weight.
Store the record where people work: in the design system documentation, as annotations on the color styles in the design tool, and as comments or metadata on the design tokens in code. Name tokens by role, such as text-secondary or border-input, rather than by appearance, so that developers pick the right pairing by purpose instead of guessing which gray looks closest.
Making the accessible choice the default
Components should ship with passing colors built in. A card component that sets its own text colors against its own background removes the decision from the person assembling a page. Limiting the number of grays in the system also helps. A palette with a dozen near-identical grays invites someone to pick the one that fails. For smaller organizations without a dedicated design system team, a short, well-maintained pairing table often delivers most of the benefit, as discussed in accessibility for small teams.
10. Verify in the Browser and Prevent Regressions
Design-time checks catch most problems, but the built product is what users see. Rendering, fonts, opacity, overlapping elements and content added through a CMS can all change the real result.
Testing the built product
- Run automated checks. Browser extensions and automated accessibility engines flag text that fails contrast against a computed solid background. They are fast and should run on every template.
- Review what automation misses. Automated tools generally cannot evaluate text over images or gradients reliably, and may report those as needing manual review. Check them by sampling.
- Check non-text elements manually. Field borders, icons, focus indicators and chart elements are often not covered by automated contrast rules.
- Test states. Tab through the page to see focus, hover over controls, trigger errors and open menus, then check the new pairings.
- Test both schemes and zoom levels. Switch the operating system to dark mode and repeat. Zoom text to 200 percent to confirm nothing overlaps backgrounds it was not designed for.
Keeping it fixed
Add contrast rules to automated tests in the build pipeline, so a change to a token that breaks a pairing fails before release. Include contrast in the content editing guidelines for anyone who publishes pages, and audit new campaign templates before they launch. Where failures are widespread across an existing site, prioritize by traffic and task importance: body text, navigation, forms and checkout first, then secondary templates. For readers with more significant visual impairments, contrast is one part of a broader set of decisions covered in designing for low vision.
Going beyond the minimum
AA is a floor. Where it costs little, aim higher: body text at 7:1 or more is comfortable for more readers and in more conditions, such as glare on a phone screen. Work is also underway on newer contrast models that account for font size, weight and polarity more precisely than the current ratio, but the WCAG 2 ratio remains the measure that standards and legal requirements reference today, so design to it first.
When contrast failures are widespread, when brand colors cannot meet requirements without difficult trade-offs, or when a palette needs to be extended accessibly across light and dark schemes, our web performance and accessibility team can audit the current state, propose tested pairings and help carry them through design system and code.
Verdict Color contrast is the most commonly failed accessibility criterion and the easiest to prevent. Check 4.5:1 for normal text and 3:1 for large text and interface elements at the moment colors are chosen, test text over images at the worst-case spot, treat dark schemes and every interactive state as separate checks, and record approved pairings so the accessible choice becomes the default. The teams that get this right do not test harder at the end; they decide earlier.
Where this comes from
- W3C Web Accessibility Initiative — Contrast minimum
- Deque University — Color contrast
- Material Design — Accessible color
The figures and practices above come from the sources listed.
Working on something like this?
We take on Performance & Accessibility work for teams who want it done once, properly. Tell us what you are building and we will tell you honestly whether we are the right studio for it. Start a project.
Where to go next
Spotted something wrong? Report an error on this page. We correct on the page and say what changed.