# Dark Theme Implementation ## Overview EVE now features a comprehensive dark theme system that ensures all UI elements look beautiful in both light and dark modes, with automatic system preference detection. ## Features ### Theme Options 1. **Light Mode** ☀️ - Clean, bright interface 2. **Dark Mode** 🌙 - Easy on the eyes, default theme 3. **System Mode** 🖥️ - Automatically follows OS theme preference ### Key Capabilities - **Automatic Detection** - Respects system dark mode preferences - **Persistent Storage** - Theme choice saved across sessions - **Instant Switching** - Changes apply immediately - **Comprehensive Coverage** - All UI elements support both themes - **Beautiful UI** - Carefully crafted color schemes for both modes ## Implementation Details ### Architecture #### Theme Manager (`src/lib/theme.ts`) A singleton class that handles: - Theme state management - LocalStorage persistence - System preference detection via `prefers-color-scheme` media query - Dynamic HTML class application (`dark` class on root element) - Real-time system theme change detection ```typescript export class ThemeManager { setTheme(theme: 'light' | 'dark' | 'system'): void getTheme(): 'light' | 'dark' | 'system' isDark(): boolean } ``` #### Settings Store Integration Theme preference is stored in `settingsStore`: - Persisted to LocalStorage via Zustand middleware - Accessible throughout the app - Defaults to `'dark'` #### CSS Variables TailwindCSS dark mode classes are used throughout: - `dark:bg-gray-800` for dark backgrounds - `dark:text-white` for dark text colors - `dark:border-gray-700` for dark borders - etc. ### Components with Dark Mode All components support dark mode via Tailwind's `dark:` prefix: #### Core UI - ✅ `App.tsx` - Main app container - ✅ `ChatInterface.tsx` - Chat area - ✅ `ChatMessage.tsx` - Message bubbles - ✅ `SettingsPanel.tsx` - Settings modal #### Selectors - ✅ `ModelSelector.tsx` - AI model dropdown - ✅ `CharacterSelector.tsx` - Character picker #### Advanced Features - ✅ `ConversationList.tsx` - Conversation browser - ✅ `MessageContent.tsx` - Markdown renderer - ✅ `CodeBlock.tsx` - Code syntax highlighting - ✅ `MermaidDiagram.tsx` - Diagram renderer - ✅ `TTSControls.tsx` - Audio controls - ✅ `VoiceInput.tsx` - Microphone controls - ✅ `FileUpload.tsx` - File upload area - ✅ `FilePreview.tsx` - File preview cards ### Theme Selector UI Located in `SettingsPanel` > Appearance section: - **Visual Design**: Three large, clickable cards - **Icons**: Sun (light), Moon (dark), Monitor (system) - **Active State**: Blue border and background highlight - **Responsive**: Works on all screen sizes - **Accessible**: Clear labels and visual feedback ## User Experience ### Default Behavior 1. App opens in **dark mode** by default 2. User can change theme in Settings > Appearance 3. Theme persists across app restarts 4. System mode respects OS preference changes in real-time ### Theme Persistence - Stored in: `localStorage` → `eve-settings` → `theme` field - Survives app restarts - Synced across all app windows/tabs (if web version) ### Visual Consistency #### Dark Mode Palette - **Background**: Gray 900-800 gradient - **Cards**: Gray 800 - **Borders**: Gray 700 - **Text**: White / Gray 300 - **Accents**: Blue 500 #### Light Mode Palette - **Background**: Blue 50 → Indigo 100 gradient - **Cards**: White - **Borders**: Gray 200-300 - **Text**: Gray 800 / Gray 600 - **Accents**: Blue 500 ## Technical Implementation ### 1. Theme Initialization In `App.tsx`: ```typescript useEffect(() => { const themeManager = getThemeManager() themeManager.setTheme(theme) }, [theme]) ``` ### 2. HTML Class Application The theme manager adds/removes the `dark` class on ``: ```typescript if (isDark) { document.documentElement.classList.add('dark') } else { document.documentElement.classList.remove('dark') } ``` ### 3. CSS Variable System In `index.css`: ```css :root { --background: 0 0% 100%; --foreground: 222.2 84% 4.9%; /* ... more variables */ } .dark { --background: 222.2 84% 4.9%; --foreground: 210 40% 98%; /* ... dark mode overrides */ } ``` ### 4. Component Styling Components use Tailwind's `dark:` prefix: ```jsx
Text
Text