GUIDE深度 · Deep dive
How WCAG Contrast Works
Contrast is not a color difference but a ratio of relative luminance. Linearize sRGB, weight by 0.2126/0.7152/0.0722, then compute (L1+0.05)/(L2+0.05).
Thresholds
Normal text: AA 4.5:1, AAA 7:1.
Large text: AA 3:1, AAA 4.5:1.
Non-text UI components: 3:1.
Large text definition
About 24px regular or 18.66px bold and above.
Judge in CSS pixels after responsive scaling.
FAQ
Do darker colors always mean higher contrast?
No; it depends on the luminance gap, not absolute darkness.
What about transparent backgrounds?
Composite onto the actual background first.