UI Color Palette & WCAG Contrast Checker

Verify accessibility compliance across Web Content Accessibility Guidelines (WCAG) 2.1 Level AA and AAA thresholds. Generate cohesive, mathematically balanced Tailwind CSS color ramps instantly.

UI Color Palette & WCAG 2.1 Contrast Checker

Test foreground/background accessibility compliance and generate programmatic Tailwind color ramps.

WCAG Contrast Ratio
10.84 : 1
High Contrast Passed
WCAG 2.1 Criteria Matrix
Normal Text (AA ≥ 4.5:1)PASS (AA)
Normal Text (AAA ≥ 7:1)PASS (AAA)
Large / Bold Text (≥ 3:1)PASS
UI Icons & Borders (≥ 3:1)PASS
Live UI Preview

Accessible Headline Render

This interactive preview simulates body copy, UI typography, and contrast visibility directly using your selected foreground and background colors.

Inline Hyperlink →
Programmatic Tailwind Palette Scale

Calculated lightness ramp for #2dd4bf

The Science of Color Contrast and Digital Accessibility Engineering

Digital accessibility is no longer merely a design suggestion; it is a legal requirement under the Americans with Disabilities Act (ADA Title III), the European Accessibility Act (EAA), and Section 508 of the US Rehabilitation Act. At the foundation of visual web accessibility lies color contrast—the luminance differential between text or interactive UI elements and their background canvas.

Millions of digital users navigate websites with moderate vision loss, color vision deficiencies (protanopia, deuteranopia, tritanopia), cataracts, or under adverse environmental conditions such as bright outdoor sunlight. When a frontend interface fails to provide sufficient contrast, critical content becomes illegible, form inputs become invisible, and user engagement collapses.

The Mathematical Formula: Relative Luminance (WCAG 2.1)

The contrast ratio between two colors is calculated mathematically using the relative luminance of each color. Relative luminance is the relative brightness of any point in a colorspace, normalized to 0 for the darkest black and 1 for the lightest white.

To determine relative luminance \(L\) in the sRGB color space:

  1. Normalize the 8-bit RGB channels to a decimal between 0.0 and 1.0 (R_sRGB = R / 255).
  2. Convert the gamma-compressed sRGB values to linear color values:
    if (V <= 0.03928) {
      V_linear = V / 12.92;
    } else {
      V_linear = Math.pow((V + 0.055) / 1.055, 2.4);
    }
  3. Apply the human eye's spectral sensitivity weighting coefficients (which prioritize green over red and blue due to human photopic vision):
    L = 0.2126 * R_linear + 0.7152 * G_linear + 0.0722 * B_linear;
  4. Finally, compute the contrast ratio:
    ContrastRatio = (L1 + 0.05) / (L2 + 0.05);
    where \(L1\) is the relative luminance of the lighter color and \(L2\) is the relative luminance of the darker color. The constant 0.05 accounts for ambient light reflecting off the display screen.

Understanding the Compliance Thresholds: AA vs. AAA

Element TypeWCAG Level AAWCAG Level AAARecommended Use Case
Body Text (< 18pt)4.5 : 17.0 : 1Articles, paragraphs, table data
Large Text (≥ 18pt or 14pt bold)3.0 : 14.5 : 1Hero headlines, banner text
UI Components & Icons3.0 : 1N/AInput borders, action icons, toggles

Building Accessible Tailwind Color Palettes

A common pitfall among frontend engineers is defining brand colors in isolation without evaluating their step-by-step contrast ramps. A primary teal such as #14b8a6 might look stunning against a dark slate background, but placing white text directly inside a button with that color will fail WCAG AA (yielding only a 2.3:1 ratio).

Our built-in Tailwind shade scale generator computes a balanced 10-step lightness curve (from 50 to 950) by interpolating linear RGB vectors. This ensures that you have:

  • Subtle tints (50-200): Suitable for background badges, card borders, and hovering surfaces in light mode.
  • Mid-tones (400-600): Ideal for interactive accents, active states, and dark-theme highlights.
  • Deep shades (800-950): High-contrast surface backgrounds that support bright foreground typography without eye-straining halo artifacts.

Frequently Asked Questions

What is the minimum WCAG contrast ratio required for normal body text?

Under Web Content Accessibility Guidelines (WCAG) 2.1 Level AA, normal text (under 18pt or under 14pt bold) requires a minimum contrast ratio of 4.5:1 against its background. For enhanced accessibility (Level AAA), the requirement increases to 7:1.

What is considered "Large Text" under WCAG standards?

Large text is defined as text that is at least 18pt (typically 24px) or 14pt bold (typically 18.66px with font-weight: 700). Large text requires a minimum contrast ratio of 3:1 for Level AA and 4.5:1 for Level AAA.

Do UI components, form borders, and icons need to meet contrast ratios?

Yes. Under WCAG 2.1 Success Criterion 1.4.11 (Non-text Contrast), user interface components (such as active button borders, form field outlines, and focus rings) and meaningful graphical icons must maintain a minimum contrast ratio of 3:1 against adjacent colors.

Why does pure white text on pure black background sometimes cause eye strain?

Pure black (#000000) against pure white (#ffffff) produces an extreme 21:1 contrast ratio. For many users with astigmatism or light sensitivity, this extreme contrast causes "halation" or glowing text blur. Leading design systems use dark slate (#020617 or #0f172a) and soft white (#f8fafc) to provide high readability (over 14:1) without visual fatigue.