Skip to content

Conversation

PrayagCodes
Copy link

@PrayagCodes PrayagCodes commented Oct 20, 2025

Description

This PR fixes sidebar text contrast issues in the Explorer when users adjust theme lightness settings. Sidebar header and item text colors are now dynamic and adapt to the current theme lightness, ensuring readability across all configurations.

Before

image

After

image

Implementation

image

Related Issue

Closes Issue #2 - [BUG] Sidebar header text unreadable with certain theme lightness settings #6

Core Functionality

  • Made sidebar title text color dynamic (adapts to theme lightness)
  • Made sidebar item text color dynamic (adapts to theme lightness)
  • Implemented adaptive background colors for active sidebar items
  • Made window action button icons (minimize, maximize, close) dynamic
  • Fixed CSS variables initialization on app startup

CSS Variables

  • Added --primary-color-sidebar variable for future extensibility
  • Added --primary-color-sidebar-item variable for active item backgrounds
  • Added --window-sidebar-active-bg variable to link active items to theme
  • Added --window-action-btn-filter variable for window control buttons

Theme Service

  • Extended reload_() method to dynamically set colors based on lightness
  • Fixed initialization bug where CSS variables weren't set on first load
  • Uses existing light_text threshold (< 60) for consistency

Implementation Details

  • Text color switching: light_text ? 'white' : '#373e44'
  • Active background switching: light_text ? '#5a5d61aa' : '#fefeff'
  • Icon filter switching: light_text ? 'invert(1) brightness(2)' : 'none'
  • Uses existing CSS variable infrastructure for consistency
  • Threshold at lightness value 60 (consistent with existing theme logic)

Testing Performed

  • Tested at lightness values: 0, 30, 60, 90, 100
  • Verified header readability across all lightness values
  • Verified sidebar items (Home, Documents, Public, Pictures, Videos) readability
  • Tested active item selection contrast on dark themes
  • Tested active item selection contrast on light themes
  • Verified window control buttons (minimize, maximize, close) visibility
  • Tested with both saved theme preferences and default state
  • Confirmed no visual regressions on other UI elements

Files Modified

  • src/gui/src/css/style.css - CSS variables and styling for sidebar and window controls
  • src/gui/src/services/ThemeService.js - Dynamic color switching logic and initialization fix

…s-#issue-2

## Problem
When adjusting the lightness level of screen themes, sidebar header texts
and item labels in the explorer become unreadable due to poor contrast
between text and background colors.

## Root Cause
- Sidebar title and item text colors were hardcoded (#8f96a3 and #444444)
- Active item backgrounds were fixed to white (#fefeff)
- No dynamic color adjustment based on theme lightness

## Solution
Implement dynamic contrast adjustment for sidebar text and backgrounds:

### Changes:
- style.css (lines 1225, 1250): Use var(--window-sidebar-color) for text
- style.css (lines 92-93, 106, 1262): Add dynamic active item backgrounds
- ThemeService.js (line 124): Switch colors based on lightness threshold

### Behavior:
- Lightness < 60: White text on dark backgrounds
- Lightness >= 60: Dark text (#373e44) on light backgrounds
- Active items: Contrasting backgrounds in all themes

## Testing
- Verified readability at lightness values: 0, 30, 60, 90, 100
- Tested with 'Favorites' header and all sidebar items
- Confirmed WCAG accessibility compliance

Resolves sidebar readability issues across theme configurations.
@PrayagCodes PrayagCodes changed the title fix: sidebar text contrast issues across theme lightness settings Fix Issue #2 - [BUG] Sidebar header text unreadable with certain theme lightness settings Oct 20, 2025
Implement dynamic contrast adjustment for  window controls that
adapts to theme lightness settings.

Changes:
- Window action buttons (minimize, maximize, close) icons adapt to theme
- CSS variables initialized properly on app startup
@PrayagCodes PrayagCodes marked this pull request as ready for review October 20, 2025 05:37
@PrayagCodes PrayagCodes changed the title Fix Issue #2 - [BUG] Sidebar header text unreadable with certain theme lightness settings fix: Issue #2 - [BUG] Sidebar header text unreadable with certain theme lightness settings Oct 20, 2025
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.

Issue #2 - [BUG] Sidebar header text unreadable with certain theme lightness settings

1 participant