How to Check Color Contrast for WCAG Compliance
A light gray placeholder may look restrained on a designer’s monitor and become unreadable for a visitor in bright sunlight, on a low-quality display, or with low vision. That is why knowing how to check color contrast is not a cosmetic exercise. It is a core WCAG requirement that affects whether people can read, navigate, submit forms, and complete essential tasks on your WordPress website.
Color contrast failures are also among the most common issues identified in accessibility audits. They often appear in theme defaults, page-builder modules, custom buttons, form validation messages, and PDF content added long after a site launches. The good news is that most contrast issues are straightforward to identify and remediate when testing is part of the publishing workflow.
What WCAG Requires for Color Contrast
WCAG measures contrast as a ratio between the relative luminance of a foreground color and its background. The scale runs from 1:1 for identical colors to 21:1 for black against white. Higher ratios generally make content easier to perceive.
For WCAG 2.1 and WCAG 2.2 Level AA, standard text must meet a minimum contrast ratio of 4.5:1 against its background. Large text has a lower requirement of 3:1. Large text means at least 18 point regular text, or 14 point bold text, using the traditional WCAG definition. In web terms, do not assume a large-looking heading qualifies. The rendered size and weight matter.
Non-text user interface components and meaningful graphical objects generally need a 3:1 contrast ratio. This includes button boundaries when the boundary communicates the control, input borders, selected states, focus indicators, chart elements, and icons that convey information. Decorative graphics do not need to meet this criterion, but any graphic a visitor must understand or operate does.
Level AAA uses stricter targets: 7:1 for normal text and 4.5:1 for large text. AAA can be appropriate for specific high-risk content or audiences, but it is not a practical blanket requirement for every production site. For most organizations, the operational baseline is WCAG AA, paired with careful testing of critical user journeys.
How to Check Color Contrast Correctly
Start with the actual foreground and background colors users see in the published interface. A design file or style guide is useful, but it is not enough. Transparency, background images, gradients, overlays, hover effects, and inherited CSS can change the final rendered color substantially.
Use a contrast checker to enter the foreground and background color values, typically hexadecimal, RGB, or HSL values. The checker should report the ratio and indicate whether it passes normal text, large text, and non-text requirements. Test the colors at their rendered state rather than relying on a palette’s intended values.
For example, dark blue text on a white background may pass easily. But if that same text sits over a semi-transparent white panel on top of a hero image, different areas of the image can lower the effective contrast. In that situation, test the lowest-contrast part of the image, or use a solid background behind the text. A passing ratio in one part of the banner does not make the entire component accessible.
Do not stop at body copy and headings. Review the interface elements that people depend on to complete a task: navigation links, primary and secondary buttons, form labels, placeholders, error messages, success notices, accordions, tabs, modal controls, search fields, pagination, cookie banners, and embedded application interfaces.
Check every interactive state
A button can pass in its default state and fail when a visitor hovers over it or tabs to it with a keyboard. Test default, hover, focus, active, disabled, selected, visited, error, and success states where applicable.
Keyboard focus deserves particular attention. A visible focus indicator is required for keyboard users to determine where they are on the page. Under WCAG 2.2, Focus Appearance adds more detailed requirements at Level AA. A faint outline that disappears into a button, card, or page background can create both a contrast failure and a serious usability barrier.
Test text placed on images and gradients
Text over photography is a frequent source of inconsistent results. A checker can only evaluate a specific color pair, while the image behind the text may contain dozens of colors. If the background varies, the text must remain readable across the full image area.
Reliable solutions include using a solid color panel, applying a sufficiently opaque overlay, selecting a simpler image crop, or moving the text away from high-detail areas. Adding a subtle shadow can improve perception in some cases, but it should not be the only method used to achieve a passing contrast ratio. Test the rendered result, not the design intent.
Do Not Use Color as the Only Signal
A passing contrast ratio does not resolve every color-related accessibility issue. WCAG also requires that color not be the sole method for conveying information, indicating an action, prompting a response, or distinguishing an element.
A form field with only a red border to indicate an error is a common failure. The error should also include clear text explaining what is wrong and how to fix it. Similarly, a chart that differentiates categories only with colored lines or slices needs labels, patterns, markers, or another non-color cue.
Links inside paragraphs present another practical concern. If links are distinguished from surrounding text only by color, the link color needs sufficient contrast against the body text, generally 3:1, in addition to meeting text contrast requirements against the page background. An underline or another persistent visual treatment is often the safer choice because it does not require visitors to perceive a subtle color change.
Where WordPress Sites Commonly Fail
WordPress sites can contain contrast issues in places that content editors do not directly control. A theme update may change a button color. A page builder may apply opacity to a section background. A plugin may insert notices, filters, calendars, or checkout fields using its own styles. Custom post types and template files can introduce one-off components that never appear on standard pages.
PDFs are another concern. A contrast fix on the web page does not make the linked document accessible. If visitors must read, complete, or download a PDF, audit its text, form fields, charts, and navigation independently.
Manual spot checks are valuable, especially for visual judgment and complex designs. They are not sufficient for a large site with frequent publishing, multiple editors, and third-party components. Automated testing provides the coverage needed to find repeated patterns and catch regressions before inaccessible content reaches the public.
WP ADA Compliance Check can scan WordPress content, theme files, custom post types, widgets, menus, linked pages, and other site elements for WCAG-related issues, then provide remediation guidance tied to the affected content or code location. This makes contrast testing part of a repeatable compliance process rather than a one-time design review.
Fixing Contrast Failures Without Breaking the Design
The fastest fix is not always the best fix. Changing text from light gray to nearly black may pass the ratio but may also undermine a carefully structured visual hierarchy. Instead, adjust the color system deliberately. Darken secondary text, increase the contrast of interactive controls, and reserve low-contrast colors for purely decorative treatments that do not carry information.
When revising a component, test the full combination: text, icon, border, background, focus indicator, and state changes. A dark button with white text may pass, while its outlined hover state fails because the border is too faint. Consistency matters because visitors should not have to relearn which controls are available from one template to another.
Document approved color pairings in your design system or WordPress block patterns. That reduces editorial guesswork and prevents authors from choosing brand colors that look acceptable but fail WCAG. Publishing controls and scheduled scans add another layer of protection when several teams contribute content.
Color contrast is one of the clearest places where accessibility discipline improves everyday usability. Build testing into design, development, content entry, and post-update QA, and the site becomes easier to read for every visitor while reducing avoidable compliance exposure.
Subscribe
Subscribe to receive daily Web Accessibility - Did you know? articles in your inbox.

