A WCAG contrast checker calculates the ratio between foreground text colors and background colors to determine readability. It compares luminance values to ensure text meets accessibility standards like AA or AAA, providing instant pass/fail verdicts for your design choices.
Why Contrast Matters for Accessibility
Contrast is the difference in perceived brightness between two colors. Low contrast makes text difficult to read for users with low vision, color blindness, or those using screens in bright environments. High contrast ensures legibility across devices and lighting conditions. When you choose colors for buttons, links, body text, or icons, you are deciding how easily people can distinguish elements from their backgrounds.
A contrast checker automates this judgment by calculating the ratio between foreground and background luminance, removing guesswork from your design decisions. Instead of eyeballing whether a gray text looks readable on a white background, you get a precise mathematical ratio. This helps you avoid common pitfalls, such as using light gray text on a white background that looks fine on a high-quality monitor but disappears on a cheap screen or in sunlight.
Understanding AA and AAA Standards
WCAG defines two levels of contrast compliance: AA and AAA. AA is the standard most organizations target, requiring a minimum contrast ratio of 4.5:1 for normal text and 3:1 for large text. AAA is stricter, requiring 7:1 for normal text and 4.5:1 for large text. Large text is generally defined as 18pt regular or 14pt bold, but always check your specific project requirements.
UI components like buttons, form fields, and icons also need sufficient contrast against adjacent colors. A checker evaluates each pair independently. For example, white text on a blue button might pass AA for large text but fail AAA. Knowing which standard applies to your project helps you prioritize adjustments without over-correcting. If you are building a public-facing website, aiming for AA is usually sufficient. If you are building a specialized tool for users with significant visual impairments, AAA might be necessary.
Step-by-Step: Checking Your Palette
Start with your brand color. Suppose your primary brand blue is #4A90E2 and your background is white #FFFFFF. You need to verify text colors against this background and UI element colors against both backgrounds and adjacent elements.
Drop your base color into ColorWell to generate harmonized variations. The tool creates analogous, complementary, triadic, and monochromatic schemes automatically. Each generated color is checked against your background and foreground pairs. You see AA and AAA verdicts instantly for every combination. This saves time compared to manually calculating ratios or checking each color pair in isolation.
Here is how the contrast calculation works for white text on your brand blue:
/* Foreground: #FFFFFF (White) */
/* Background: #4A90E2 (Brand Blue) */
/* Relative Luminance Formula: L = 0.2126 * R + 0.7152 * G + 0.0722 * B */
/* Where R, G, B are linearized RGB values */
/* Result for #FFFFFF on #4A90E2: ~3.2:1 */
/* Verdict: Passes AA for Large Text, Fails AA for Normal Text */
If the verdict fails, lighten or darken the background slightly. ColorWell adjusts hues in Oklch color space, so your brand blue stays consistent while contrast improves. Check the new pair until it meets your target standard. For instance, changing the background to a lighter blue #6BA5F0 might raise the contrast ratio enough to pass AA for normal text without shifting the hue noticeably.
Handling Edge Cases in UI Components
Not all elements follow the same rules. Body text needs higher contrast than large headings. Icons and borders need sufficient contrast against adjacent colors, not just backgrounds. Disabled states often have lower contrast by design, but they should still meet minimum thresholds for readability.
Consider a form field with a light gray border #CCCCCC on a white background #FFFFFF. This pair may fail contrast checks for interactive elements. Use the checker to test border colors against backgrounds and text colors against border colors. Adjust until each pair passes.
For buttons, test both text-on-button and button-on-page-background combinations. A blue button with white text might pass, but the button itself against a gray page background might fail. Run each pair through the checker separately. Here is a comparison of common scenarios:
| Element Pair | Example Colors | Typical Requirement | Common Issue |
|---|---|---|---|
| Body Text on Background | #333333 on #FFFFFF | AA (4.5:1) | Too light gray fails AA |
| Large Heading on Background | #666666 on #FFFFFF | AA Large (3:1) | Usually passes easily |
| Button Text on Button | #FFFFFF on #0056B3 | AA (4.5:1) | Depends on button shade |
| Icon on Background | #888888 on #F5F5F5 | AA (4.5:1) | Often fails due to low contrast |
Exporting Verified Tokens
Once your palette passes contrast checks, export the colors as CSS variables or Tailwind config. This ensures developers use the exact verified values. ColorWell generates named tokens like blue-500 or slate-700 for readability.
Here is a sample export after verifying your brand blue and white background:
:root {
--color-brand-blue: #4A90E2;
--color-background: #FFFFFF;
--color-text-primary: #1A1A1A;
--color-border: #E5E5E5;
}
For Tailwind, the config block looks like this:
module.exports = {
theme: {
extend: {
colors: {
brand: '#4A90E2',
background: '#FFFFFF',
text: '#1A1A1A',
border: '#E5E5E5',
},
},
},
};
Copy these tokens directly into your stylesheet or design tool. The names remain consistent across CSS, Tailwind, and Figma exports. Save your palette for future projects so you do not re-check the same colors. Every palette you build stays available for reuse, with cloud sync if needed. This workflow ensures that accessibility checks are part of the design process, not an afterthought during development.