- 👁️ Calculating relative luminance across sRGB space
- 🎨 Harmonizing primary, secondary, and surface neutrals for dark mode
- ⚡ Real-time contrast ratio auditing in the Image Color Picker Studio
Accessibility is not an afterthought — it is a fundamental requirement of modern digital product design. The Web Content Accessibility Guidelines (WCAG 2.1) establish rigorous mathematical standards to ensure that text and interactive UI elements remain legible to users with low vision, aging eyes, or situational optical fatigue.
Understanding the Relative Luminance Formula
Contrast is not simply a matter of picking “dark” text on a “light” background. The W3C defines contrast ratio based on Relative Luminance (L), normalized from 0 for pure black to 1 for pure white:
- Level AA (Minimum Contrast): Requires a contrast ratio of at least 4.5:1 for normal body text and 3:1 for large text (18pt or 14pt bold) and active UI components.
- Level AAA (Enhanced Contrast): Demands a ratio of 7:1 for regular body text and 4.5:1 for larger display typography.
Designing for Dark Mode Without Eye Strain
Avoid using pure black (#000000) with pure white (#ffffff) in dark mode, as maximum contrast can produce halation (glowing blur) on OLED displays. Instead, adopt high-compliance dark neutrals such as #121212 or #1e293b with off-white body text (#f1f5f9), achieving healthy 14:1 ratios with maximum reading comfort.