Frontend CSS Theming System Refactor
Issue Summary
The frontend components have inconsistent theming implementation with numerous hardcoded color values that break the dark/light theme system. This makes it difficult to maintain consistent styling and causes visual inconsistencies across the application.
Problem Description
Current State
- A comprehensive CSS variable system exists in
global.css with proper light/dark theme support
- Some components (like
SearchableSelect) properly use CSS variables
- Many components have hardcoded colors that ignore the theme system
- Inconsistent styling patterns across components make maintenance difficult
Specific Issues Identified
1. Hardcoded White Backgrounds
Components affected:
CardSearchSelect.svelte - dropdown background hardcoded to white
SearchableInput.svelte - modal background hardcoded to white
CardVariantSelector.svelte - modal background hardcoded to white
FeatureFlagDebugPanel.svelte - panel background hardcoded to white
Impact: These components appear with white backgrounds in dark mode, breaking the theme consistency.
2. Hardcoded Text Colors
Components affected:
App.svelte - header h1 text hardcoded to white
CardSearchSelect.svelte - text colors hardcoded to #333, #666
SearchableInput.svelte - various text colors hardcoded
CardVariantSelector.svelte - text colors hardcoded
FeatureFlagDebugPanel.svelte - button text hardcoded to white
Impact: Text doesn't adapt to theme changes, causing readability issues.
3. Hardcoded Interactive States
Components affected:
CardSearchSelect.svelte - hover states use #f0f0f0, #3c5aa6
SearchableInput.svelte - hover/focus states hardcoded
CardVariantSelector.svelte - selection states hardcoded
Impact: Interactive feedback doesn't match the current theme.
4. Hardcoded Border Colors
Components affected:
CardSearchSelect.svelte - borders use #ddd, #f0f0f0
SearchableInput.svelte - borders hardcoded
CardVariantSelector.svelte - borders hardcoded
Impact: Component boundaries don't adapt to theme.
Detailed Component Analysis
CardSearchSelect.svelte
/* PROBLEMATIC - Hardcoded values */
.dropdown {
background-color: white; /* Should be: var(--bg-dropdown) */
border: 1px solid #ddd; /* Should be: var(--border-primary) */
}
.card-item {
color: #333; /* Should be: var(--text-primary) */
border-bottom: 1px solid #f0f0f0; /* Should be: var(--border-secondary) */
}
.card-item:hover {
background-color: #f0f0f0; /* Should be: var(--bg-hover) */
color: #3c5aa6; /* Should be: var(--color-pokemon-blue) */
}
App.svelte
/* PROBLEMATIC - Hardcoded header text */
h1 {
color: white; /* Should be: var(--text-inverse) */
}
/* PROBLEMATIC - Hardcoded rgba values */
.theme-toggle {
background-color: rgba(255, 255, 255, 0.2); /* Should use theme variables */
}
Other Components
Similar patterns exist in:
SearchableInput.svelte - 15+ hardcoded color values
CardVariantSelector.svelte - 20+ hardcoded color values
FeatureFlagDebugPanel.svelte - 10+ hardcoded color values
Available CSS Variables
The following CSS variables are already defined in global.css and should be used:
Background Colors
--bg-primary - Main page background
--bg-secondary - Card containers, scrollbar tracks
--bg-tertiary - Results sections
--bg-container - Form containers
--bg-dropdown - Input fields and dropdowns
--bg-hover - Hover states
--bg-group-header - Group headers
Text Colors
--text-primary - Main text
--text-secondary - Secondary text
--text-muted - Disabled/placeholder text
--text-inverse - Text on dark backgrounds
Border Colors
--border-primary - Primary borders
--border-secondary - Secondary borders
--border-input - Input field borders
--border-focus - Focused input borders
Theme Colors
--color-pokemon-blue - Brand blue
--color-pokemon-red - Brand red
--color-pokemon-red-dark - Dark red for hover states
Proposed Solution
Phase 1: Critical Fixes
- Fix dropdown backgrounds - Replace hardcoded
white with var(--bg-dropdown)
- Fix header text - Replace hardcoded
white with var(--text-inverse)
- Fix primary text colors - Replace hardcoded dark colors with
var(--text-primary)
Phase 2: Comprehensive Refactor
- Audit all components - Systematically replace all hardcoded colors
- Standardize hover states - Use consistent
var(--bg-hover) patterns
- Unify border styling - Use theme-aware border variables
- Test theme switching - Ensure all components respond to theme changes
Phase 3: Style Guide Creation
- Document CSS variable usage - Create guidelines for component styling
- Create component templates - Standardized patterns for new components
- Add linting rules - Prevent hardcoded colors in future development
Implementation Priority
High Priority (Immediate)
Medium Priority
Low Priority
Testing Requirements
Success Criteria
- All dropdown menus respect the current theme
- Header text adapts to theme changes
- No hardcoded color values remain in component styles
- Smooth transitions between light and dark themes
- Consistent visual hierarchy across all components
Related Files
app/frontend/public/global.css - Theme variable definitions
app/frontend/src/App.svelte - Main application component
app/frontend/src/components/CardSearchSelect.svelte - Primary dropdown component
app/frontend/src/components/SearchableSelect.svelte - Reference implementation (correctly uses variables)
app/frontend/src/components/SearchableInput.svelte - Input component
app/frontend/src/components/CardVariantSelector.svelte - Modal component
app/frontend/src/components/FeatureFlagDebugPanel.svelte - Debug component
Labels
frontend
css
theming
refactor
accessibility
high-priority
Frontend CSS Theming System Refactor
Issue Summary
The frontend components have inconsistent theming implementation with numerous hardcoded color values that break the dark/light theme system. This makes it difficult to maintain consistent styling and causes visual inconsistencies across the application.
Problem Description
Current State
global.csswith proper light/dark theme supportSearchableSelect) properly use CSS variablesSpecific Issues Identified
1. Hardcoded White Backgrounds
Components affected:
CardSearchSelect.svelte- dropdown background hardcoded towhiteSearchableInput.svelte- modal background hardcoded towhiteCardVariantSelector.svelte- modal background hardcoded towhiteFeatureFlagDebugPanel.svelte- panel background hardcoded towhiteImpact: These components appear with white backgrounds in dark mode, breaking the theme consistency.
2. Hardcoded Text Colors
Components affected:
App.svelte- header h1 text hardcoded towhiteCardSearchSelect.svelte- text colors hardcoded to#333,#666SearchableInput.svelte- various text colors hardcodedCardVariantSelector.svelte- text colors hardcodedFeatureFlagDebugPanel.svelte- button text hardcoded towhiteImpact: Text doesn't adapt to theme changes, causing readability issues.
3. Hardcoded Interactive States
Components affected:
CardSearchSelect.svelte- hover states use#f0f0f0,#3c5aa6SearchableInput.svelte- hover/focus states hardcodedCardVariantSelector.svelte- selection states hardcodedImpact: Interactive feedback doesn't match the current theme.
4. Hardcoded Border Colors
Components affected:
CardSearchSelect.svelte- borders use#ddd,#f0f0f0SearchableInput.svelte- borders hardcodedCardVariantSelector.svelte- borders hardcodedImpact: Component boundaries don't adapt to theme.
Detailed Component Analysis
CardSearchSelect.svelte
App.svelte
Other Components
Similar patterns exist in:
SearchableInput.svelte- 15+ hardcoded color valuesCardVariantSelector.svelte- 20+ hardcoded color valuesFeatureFlagDebugPanel.svelte- 10+ hardcoded color valuesAvailable CSS Variables
The following CSS variables are already defined in
global.cssand should be used:Background Colors
--bg-primary- Main page background--bg-secondary- Card containers, scrollbar tracks--bg-tertiary- Results sections--bg-container- Form containers--bg-dropdown- Input fields and dropdowns--bg-hover- Hover states--bg-group-header- Group headersText Colors
--text-primary- Main text--text-secondary- Secondary text--text-muted- Disabled/placeholder text--text-inverse- Text on dark backgroundsBorder Colors
--border-primary- Primary borders--border-secondary- Secondary borders--border-input- Input field borders--border-focus- Focused input bordersTheme Colors
--color-pokemon-blue- Brand blue--color-pokemon-red- Brand red--color-pokemon-red-dark- Dark red for hover statesProposed Solution
Phase 1: Critical Fixes
whitewithvar(--bg-dropdown)whitewithvar(--text-inverse)var(--text-primary)Phase 2: Comprehensive Refactor
var(--bg-hover)patternsPhase 3: Style Guide Creation
Implementation Priority
High Priority (Immediate)
CardSearchSelect.svelte- Fixes dropdown white background issueApp.svelte- Fixes header text color issueSearchableInput.svelte- Modal background fixMedium Priority
CardVariantSelector.svelte- Complete theming overhaulFeatureFlagDebugPanel.svelte- Debug panel themingApp.svelteLow Priority
Testing Requirements
Success Criteria
Related Files
app/frontend/public/global.css- Theme variable definitionsapp/frontend/src/App.svelte- Main application componentapp/frontend/src/components/CardSearchSelect.svelte- Primary dropdown componentapp/frontend/src/components/SearchableSelect.svelte- Reference implementation (correctly uses variables)app/frontend/src/components/SearchableInput.svelte- Input componentapp/frontend/src/components/CardVariantSelector.svelte- Modal componentapp/frontend/src/components/FeatureFlagDebugPanel.svelte- Debug componentLabels
frontendcssthemingrefactoraccessibilityhigh-priority