yigityalim
projectshandbookslabshireshare
xgithub
siteprojectshandbookslabschangelog
aboutusesnowhireshare
elsewherexgithublinkedinemail
metarssllms.txtsitemap
© 2026 Yiğit Yalım. All rights reserved.
/
Back to Labs
May 10, 2026·web

Color Contrast (WCAG)

Pick foreground + background colors, compute the contrast ratio, see WCAG AA / AAA pass/fail live. Separate verdicts for normal and large text.

accessibility · wcag · color · contrast

PreviousCIDR Subnet CalculatorNextCSS Specificity Calculator

A designer's "let me lighten this gray a bit" decision can become unreadable for a colorblind user. WCAG contrast ratio turns that intuition into math. This lab updates the ratio live as you change fg/bg, with a real preview block.

ColorContrastChecker — WCAG 2.x + APCA
foreground

hsl(222° 47% 11%)

background

hsl(48° 96% 89%)

CVD sim:

The quick brown fox

jumps over the lazy dog. 1234567890.

16.03:1 · Lc -95.1

1:116.03:121:1
34.57

normal text

< 18pt / < 14pt bold

AA≥4.516.03
AAA≥716.03

large text

≥ 18pt / ≥ 14pt bold

AA≥316.03
AAA≥4.516.03

UI / graphics

WCAG 1.4.11 non-text

AA≥316.03
APCA — WCAG 3.0 candidateLc -95.1
body text (Lc60)
large text (Lc45)
UI / spot (Lc30)

APCA kullanır sRGB^2.4 transfer fonksiyonu, direktional — metin renginin arka plana göre konumu önemlidir. Negatif Lc: koyu arka plan üzerinde açık metin.

WCAG levels

LevelNormal textLarge text (≥18pt or ≥14pt bold)
AA (legal minimum in most jurisdictions)4.5:13:1
AAA (sensitive contexts)7:14.5:1

WCAG 2.x uses the relative luminance formula:

L=0.2126⋅Rl+0.7152⋅Gl+0.0722⋅BlL = 0.2126 \cdot R_l + 0.7152 \cdot G_l + 0.0722 \cdot B_lL=0.2126⋅Rl​+0.7152⋅Gl​+0.0722⋅Bl​

Then ratio = (L_lighter + 0.05) / (L_darker + 0.05). The green coefficient (0.7152) is highest because the human eye is most sensitive to green.

Common mistakes

  • Placeholder text (::placeholder) — most systems lighten input text by ~40% for placeholders. This drops contrast. Account for it in your design.
  • Disabled state — WCAG doesn't require contrast for disabled UI, but keep it readable so users can perceive the state.
  • Brand colors — your brand green #48d597 against white is 1.8:1 — fail. Use a contrast-tuned variant (a darker shade hitting 4.6:1).
  • Theme toggle — check both light and dark; a passing ratio in one mode can fail in the other.

Contrast ≠ accessibility

Hitting the ratio is the floor. For colorblindness (deuteranopia, protanopia), color alone must not carry information — pair it with an icon or label. A red form error ✓ is OK, but red + icon + text is robust.