This document outlines the accessibility improvements made to address contrast ratio issues identified by Lighthouse.
Lighthouse reported insufficient contrast ratios for several UI elements:
Background and foreground colors do not have a sufficient contrast ratio.
Low-contrast text is difficult or impossible for many users to read.
The failing elements included:
- "Vokabeln", "Grammatik", "Kultur", "Idiome" in exercise chips
- "Worterfassung" text
- Various text elements against the background
-
Primary Color Adjustment:
- Changed
--primary
from0 84.2% 60.2%
to0 84.2% 45%
- Changed
--primary-foreground
from0 0% 98%
to0 0% 100%
- This creates a darker red background with pure white text, significantly improving the contrast ratio
- Changed
-
Muted Text Enhancement:
- Changed
--muted-foreground
from240 3.8% 46.1%
to240 5% 35%
- This makes muted text darker and more readable against light backgrounds
- Changed
-
Destructive Color Consistency:
- Updated
--destructive
to match the new primary color - Changed
--destructive-foreground
to match the new primary-foreground
- Updated
These changes improve the application in several ways:
-
Better Accessibility: The enhanced contrast makes text more readable for all users, including those with visual impairments or those using the application in challenging lighting conditions.
-
WCAG Compliance: The changes help meet the Web Content Accessibility Guidelines (WCAG) 2.1 Level AA requirements, which specify a minimum contrast ratio of 4.5:1 for normal text.
-
Consistent Design: By updating related color variables together, we maintain design consistency throughout the application.
To verify these improvements:
- Run Lighthouse accessibility tests again to confirm the contrast issues are resolved
- Test the application with various screen brightness settings
- Consider using tools like the Chrome DevTools' color picker to check contrast ratios manually
When making design changes or adding new UI elements:
- Always check contrast ratios using tools like the Chrome DevTools or dedicated contrast checkers
- Consider users with different visual abilities
- Test the application under various lighting conditions
- Maintain the established color system to ensure consistency