Color Contrast
Validate WCAG 2.1 compliance for all theme color pairings. Accessible contrast ensures text is readable for all users, including those with visual impairments.
The Launch77 theme system pairs background and foreground tokens to meet accessibility standards. Check contrast ratios before customizing colors.
WCAG Standards
AA Standard (Minimum)
4.5:1 for normal text
Body text, labels, most UI content
3:1 for large text
18px+ regular or 14px+ bold text
AAA Standard (Enhanced)
7:1 for normal text
Highest accessibility level
4.5:1 for large text
18px+ regular or 14px+ bold text
Token Pair Contrast Ratios
All Launch77 theme token pairs and their current contrast ratios. Each pairing should meet at least AA standards (4.5:1).
Main page content
Contrast Ratio
Enhanced contrast - exceeds all standards
Background
#FFFFFFForeground
#0F1729Live Preview
The quick brown fox jumps
This is how the text looks on this background color.
--color-background+--color-foregroundCard surfaces
Contrast Ratio
Enhanced contrast - exceeds all standards
Background
#FFFFFFForeground
#0F1729Live Preview
The quick brown fox jumps
This is how the text looks on this background color.
--color-card+--color-card-foregroundPrimary buttons and active states
Contrast Ratio
Enhanced contrast - exceeds all standards
Background
#0F1729Foreground
#FFFFFFLive Preview
The quick brown fox jumps
This is how the text looks on this background color.
--color-primary+--color-primary-foregroundAccent elements
Contrast Ratio
Enhanced contrast - exceeds all standards
Background
#F1F5F9Foreground
#0F1729Live Preview
The quick brown fox jumps
This is how the text looks on this background color.
--color-accent+--color-accent-foregroundSubtle UI elements
Contrast Ratio
Acceptable for large text only (18pt+ or 14pt+ bold)
Background
#F1F5F9Foreground
#65758BLive Preview
The quick brown fox jumps
This is how the text looks on this background color.
--color-muted+--color-muted-foregroundSecondary buttons
Contrast Ratio
Enhanced contrast - exceeds all standards
Background
#F1F5F9Foreground
#0F1729Live Preview
The quick brown fox jumps
This is how the text looks on this background color.
--color-secondary+--color-secondary-foregroundError states
Contrast Ratio
Acceptable for large text only (18pt+ or 14pt+ bold)
Background
#EF4343Foreground
#FAFAFALive Preview
The quick brown fox jumps
This is how the text looks on this background color.
--color-destructive+--color-destructive-foregroundCommon Contrast Issues
Example: Sidebar Hover State Issue
When --color-foreground and --color-primary are the same color, hover states can create contrast issues where text becomes unreadable.
Sidebar Color Issue Demo
Demonstrates the contrast problem with active menu items on hover
Visual Demo
Unselected menu item (default):
Active menu item (default):
Contrast: 17.87:1 - Enhanced contrast - exceeds all standards
Active menu item (on hover):
Contrast: 1.00:1 - Insufficient contrast - fails WCAG standards
Technical Explanation
isActive && 'bg-primary text-primary-foreground hover:bg-primary/90'
✓ Active state uses primary + primary-foreground
'hover:bg-muted hover:text-foreground'
✗ Hover applies text-foreground to ALL items (including active)
Problem:
When --color-foreground and --color-primary are similar colors, the hover state creates dark text on dark background.
Current Color Values
primary#0F1729
foreground#0F1729
primary-fg#FFFFFF
Why This Happens
The Sidebar component applies hover:text-foreground to all menu items. When an item is active (using bg-primary and text-primary-foreground), hovering changes the text color to foreground.
If foreground and primary are the same color, you get dark text on a dark background.
Current Implementation:
// In Sidebar.tsx (lines 277-278)
<SidebarMenuButton
className={cn(
'hover:text-foreground', // ⚠️ Applied to ALL items
isActive && 'bg-primary text-primary-foreground hover:bg-primary/90'
)}
/>Recommended Fix:
// Preserve text-primary-foreground on active+hover
<SidebarMenuButton
className={cn(
'hover:bg-muted',
isActive
? 'bg-primary text-primary-foreground hover:bg-primary/90 hover:text-primary-foreground'
: 'text-muted-foreground hover:text-foreground'
)}
/>Testing Custom Colors
Before Customizing Brand Colors
1. Check Contrast Ratios
Use the contrast checkers above to verify your custom colors meet WCAG AA standards (4.5:1 minimum).
2. Test All Token Pairs
Ensure each background token has sufficient contrast with its paired foreground token:
- • primary + primary-foreground
- • card + card-foreground
- • muted + muted-foreground
- • destructive + destructive-foreground
- • etc.
3. Test Interactive States
Verify hover, focus, and active states maintain readable contrast. Pay special attention to components that combine multiple tokens (like the Sidebar example above).
Tools for Testing:
- • Use browser DevTools to inspect computed colors in different states (hover, focus, active)
- • Test with Chrome DevTools vision deficiency emulator (Rendering > Emulate vision deficiencies)
- • Use online contrast checkers like WebAIM Contrast Checker