49 - Themes
Overview
Architecture Diagram
┌──────────────────────────────────────────────────────────────────────────────┐
│ Theme Architecture │
└──────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────┐
│ Theme Configuration │
│ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ Zustand Theme Store │ │
│ │ │ │
│ │ state: { │ │
│ │ mode: 'light' | 'dark', │ │
│ │ color: 'zinc' | 'blue' | 'green' | 'violet' | ... │ │
│ │ appMode: 'live' | 'analyzer', │ │
│ │ isTogglingMode: boolean │ │
│ │ } │ │
│ │ │ │
│ │ actions: { │ │
│ │ setMode(mode), │ │
│ │ setColor(color), │ │
│ │ setAppMode(appMode), │ │
│ │ toggleMode(), │ │
│ │ toggleAppMode(), // async - calls backend │ │
│ │ syncAppMode() // sync with backend state │ │
│ │ } │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │ │
│ │ persist to localStorage │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ localStorage │ │
│ │ │ │
│ │ openalgo-theme: { │ │
│ │ "state": { │ │
│ │ "theme": "dark", │ │
│ │ "accentColor": "blue" │ │
│ │ } │ │
│ │ } │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────────┘
│
│ Apply to DOM
│
▼
┌─────────────────────────────────────────────────────────────────────────────┐
│ DOM Application │
│ │
│ <html data-theme="dark" class="accent-blue"> │
│ <body class="bg-base-100 text-base-content"> │
│ <!-- DaisyUI components inherit theme --> │
│ </body> │
│ </html> │
│ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ CSS Variables Applied │ │
│ │ │ │
│ │ --primary: hsl(217, 91%, 60%) /* Accent color */ │ │
│ │ --secondary: hsl(217, 33%, 17%) │ │
│ │ --accent: hsl(217, 91%, 70%) │ │
│ │ --base-100: hsl(0, 0%, 100%) /* Light mode */ │ │
│ │ --base-100: hsl(220, 13%, 18%) /* Dark mode */ │ │
│ │ --base-content: hsl(220, 13%, 69%) │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────────┘Theme Store Implementation
Zustand Store
DOM Application
Available Themes
Color Modes
Theme Colors (12 options)
Color
Use Case
App Mode (Live vs Analyzer)
Implementation
Theme Settings UI
Theme Toggle Component
Color Picker Component
Settings Page Section
CSS Implementation
DaisyUI Theme Configuration
Accent Color CSS
System Preference Detection
Key Files Reference
File
Purpose
Last updated