Lesson 1 of 30
"Looks readable to me" isn't a test. Contrast is a ratio computed from rendered luminance, and it's exactly precise enough to pass or fail — which is why colors that look fine on screen still ship broken.
13 min read
Every option explains itself — why the right one is right, and why each wrong one is wrong. Miss one and it comes back later on a spaced-repetition schedule.
Question 1 of 3
A large, bold heading (20px, weight 700) needs to pass WCAG AA. What contrast ratio does it actually need?
Hints without spoilers, and a plain explanation of why a wrong answer was wrong — answered only from this lesson. Free account, no card.
Sign up freeWhat interviewers actually ask about this, and what a strong answer has to cover.
A strong answer covers
Likely follow-ups
Color communicates meaning and hierarchy — but whether text is actually readable isn't a matter of taste. It's a number: the contrast ratio between a foreground and background color, computed from their relative luminance (how much light each color reflects, weighted the way human eyes perceive brightness — green reads much brighter than blue at the same numeric value).
The ratio ranges from 1:1 (identical colors, invisible) to 21:1 (pure black on pure white). WCAG sets minimum ratios for different text: 4.5:1 for normal body text, 3:1 for large text (24px+, or 18.66px+ bold) and for meaningful UI components/icons. Below the threshold, text doesn't just look "a bit dim" — it fails for a real, definable slice of your users: anyone with low vision, anyone on a washed-out monitor, anyone in bright sunlight.
This isn't a hypothetical. This exact platform had this exact bug:
// A chat-bubble role label, meant to look "de-emphasized" next to the message
<span style={{ opacity: 0.75 }}>You</span>
White text (#ffffff) on this app's jade accent background computes to a clean 4.92:1 — comfortably above the 4.5:1 bar. But opacity: 0.75 doesn't just make the text fainter — it blends the whole element 25% toward whatever's behind it. Because the label's own backdrop is that same accent color, the rendered result is white blended toward green: #bfe0d4. Re-measured against the same background, that's 3.44:1 — a real, measured failure, not a rounding error.
A white label at full opacity on this app's own accent green — a flat 4.92:1. Comfortably above the 4.5:1 bar.
The token was never wrong. opacity silently changed what actually got painted to the screen, and nothing about the code looked broken — no red squiggly line, no visual "that's clearly too faint" moment on a bright monitor. It took an automated contrast scan to catch it.
"How would you verify this design is accessible?" is a very common frontend question, and it's a filter: candidates who answer "make sure the text is easy to read" are eyeballing. Candidates who answer "compute the contrast ratio between the rendered foreground and background, check it against 4.5:1 or 3:1 depending on text size, and don't trust opacity or gradients without re-measuring the actual painted color" are reasoning about a system with a testable, falsifiable rule — which is exactly the difference this platform is built to drill.