Implement theme toggle system with localStorage persistence #30
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
Create a theme toggle system using Dash clientside callbacks that persists the user's theme preference in localStorage. Dark theme should be the default.
Files to Create
portfolio_app/callbacks/__init__.pyportfolio_app/callbacks/theme.pyTechnical Design
Theme State Management
dcc.Store for theme state:
id="theme-store"storage_type="local"(localStorage persistence){"colorScheme": "dark"}Theme Application: Set
data-mantine-color-schemeattribute on document rootClientside Callbacks
1. Theme Toggle Callback
Triggered when theme toggle button is clicked.
2. Theme Initialization Callback
Apply theme from localStorage on page load.
3. Toggle Icon Update
Update the theme toggle button icon based on current theme.
Registration Function
Integration Points
id="theme-toggle-btn"id="theme-toggle-icon"(DashIconify component)id="theme-store"forceColorSchemeAcceptance Criteria
Part of Sprint 7 (#27)