HomePluginsToolsGuidesPortfolioWorkflowAboutWork with usContact
GetSet

We build and fix production web applications, and publish the UI packages and free browser tools on this site.

info@get-set.it

Explore

  • Plugins
  • Tools
  • Guides
  • Portfolio

Company

  • About
  • Workflow
  • Work with us
  • Contact

Legal

  • Terms
  • Privacy
  • Accessibility
  • Cookies

© 2026 GetSet

We're on npm

Your Bundle

Your bundle is empty

Add plugins from the catalog to build one combined CDN link — like picking font families.

Browse plugins
Guides / Accessibility

WCAG Color Contrast: What 4.5:1 Actually Means and How to Hit It

How contrast ratio is computed, the difference between AA and AAA, the large-text exception, why gray-on-white designs fail, and how OKLCH makes fixing contrast systematic.

By the GetSet engineering team · Published 2026-08-06 · 7 min read · Related tool: Color Studio

The ratio, demystified

Contrast ratio compares the relative luminance of two colors on a scale from 1:1 (identical) to 21:1 (black on white). Luminance is not the average of RGB channels — it is weighted by human sensitivity (green counts ~6× more than blue) and gamma-corrected. This is why two colors that "look similar in brightness" can measure very differently, and why eyeballing contrast fails.

  • WCAG AA (the legal baseline in many jurisdictions): 4.5:1 for body text, 3:1 for large text (18pt+, or 14pt bold) and UI components.
  • WCAG AAA: 7:1 for body text — appropriate for reading-heavy products and low-vision audiences.
  • Placeholder text, disabled buttons and decorative elements are exempt — but users still have to read your placeholders, so treat the exemption skeptically.

Why fashionable gray fails

The classic failure is #999999 body text on white: it measures 2.85:1, well short of 4.5:1, yet it appears in countless designs because it "looks clean." The darkest gray that passes AA on pure white is roughly #767676. Muted design and accessible design are compatible — but only if you check, because the eye adapts and the designer’s calibrated monitor is the best-case scenario your users will never share.

Fixing contrast without wrecking the palette

In OKLCH color space, the L channel tracks perceived lightness directly. That turns contrast repair into a mechanical operation: keep hue and chroma, move only L until the ratio passes. The color stays recognizably "your brand blue" — just far enough from its background to read. In sRGB/HSL this is trial and error; in OKLCH it is a slider.

Check WCAG ratios live, convert between HEX, RGB, HSL and OKLCH, and generate accessible tints and shades of any brand color with Color Studio. If the failing text sits on a gradient or glass surface, test against the lightest region — see our guide on modern CSS effects.

Dark mode doubles the work

A palette that passes in light mode does not pass by inversion. Pure white text on pure black measures 21:1 but causes halation — the glow that makes text swim for astigmatic readers (roughly a third of adults). The fix is to soften both ends: an off-white like #e6e6e6 on a near-black like #121212 keeps a ratio around 15:1 with far less glare. Brand accent colors usually need a *lighter* variant for dark backgrounds — the same saturated blue that passes on white fails on dark gray — which is why design systems define semantic tokens (text-link) that resolve to different hexes per theme rather than reusing one brand hex everywhere.

  • Test every accent in both themes; keep a small table of ratios next to your tokens.
  • Elevation in dark mode is lighter surfaces, not shadows — shadows are invisible on dark backgrounds.
  • Desaturate large color areas slightly in dark mode; full-saturation fills vibrate against dark neutrals.

APCA and what comes after WCAG 2

The WCAG 2 contrast formula is known to be imperfect: it over-penalizes some light-on-dark combinations and under-penalizes thin, light-weight text. The Advanced Perceptual Contrast Algorithm (APCA), developed for WCAG 3, models perceived lightness more faithfully and accounts for font size and weight, producing an Lc value rather than a ratio. It is not yet the legal standard — AA/AAA ratios remain what audits and regulations reference — but it is a better design tool. A practical approach today: meet WCAG 2 ratios for compliance, then sanity-check borderline pairs with APCA, and give thin or small text extra margin under both.

Beyond text: the 3:1 rules people miss

  • Form input borders need 3:1 against the page background — the invisible-input pattern fails audits.
  • Focus indicators need 3:1 against adjacent colors; removing outlines without a replacement is the most common keyboard-accessibility failure.
  • Charts need 3:1 between adjacent series or a redundant channel (patterns, direct labels) — color-only encoding excludes roughly 1 in 12 men with color-vision deficiency.

Keep reading

Images

WebP vs AVIF vs PNG vs JPG: Choosing the Right Image Format in 2026

7 min read
Data

CSV, JSON and XLSX: The Conversion Pitfalls That Corrupt Your Data

8 min read
Code

Minify vs Beautify: What Code Formatting Actually Does to Your Files

6 min read

We write these guides from our client work. If you’d rather have it built than explained, we’re available.

Work with us Contact us