Skip to content

Conversation

@tsw-codes
Copy link

Fix: Dynamic Sidebar Text Color for Improved Contrast Across Theme Lightness Settings
Description
Fixes a bug where sidebar header and item text in the explorer became unreadable when adjusting theme lightness due to hardcoded colors that didn't adapt to the background.

Problem

  • Sidebar header text used a hardcoded #8f96a3
  • Sidebar item text used a hardcoded #444444
  • The sidebar background color adapts to theme lightness
  • At certain lightness values, contrast between text and background was insufficient
  • Text became difficult or impossible to read, violating WCAG AA

Solution

  • Implements dynamic text color calculation that adapts to the sidebar background color:
  • Calculates the effective sidebar background color (accounting for alpha blend)
  • Determines optimal text color (black or white) using WCAG contrast
  • Applies the color dynamically via CSS variables
  • Ensures contrast meets WCAG AA (4.5:1)

Before Picture
issue before

Video walk through
https://cap.link/g08ak46j3bs449k

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant