Skip to content

Dark Mode Theme System with System Preference Detection #99

Description

@JamesEjembi

Problem Statement

Users need light and dark mode options for comfortable viewing during extended monitoring sessions. Implement a theme system with CSS custom properties, automatic system preference detection (prefers-color-scheme), manual toggle, and persistent preference stored in localStorage.

Technical Bounds

  • Theme tokens: 60+ CSS custom properties (colors, spacing, shadows, border-radius).
  • System preference: read prefers-color-scheme on mount; update on change via matchMedia listener.
  • Toggle: navbar button cycling system -> light -> dark.
  • Persistence: localStorage.setItem('theme', 'light'|'dark'|'system').
  • Transition: smooth color transitions (transition: background-color 0.3s, color 0.3s).
  • Charts: Lightweight Charts theme sync with current mode.

Steps

  1. Define CSS custom properties in :root (light) and [data-theme="dark"] selectors.
  2. Implement ThemeProvider context with useTheme() returning (theme, setTheme, resolvedTheme).
  3. On mount, read localStorage; fallback to prefers-color-scheme; apply data-theme attribute.
  4. Build ThemeToggle button with sun/moon/monitor icons.
  5. Migrate all component styles to use var(--color-*) tokens.
  6. Sync chart theme on mode change via chart.applyOptions().

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSIssue tracked in GrantFox OSSLayer: UI-CoreCore UI layer architectural concernMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official CampaignOfficial Campaign | FWC26Campaign: Official Campaign | FWC26enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions