Repository navigation
Description
Summary & Context
FloCafe currently has complete dark-mode CSS variable definitions (.dark { ... } in frontend/src/app/globals.css) and title-bar overlay color tokens (main/title-bar-theme.ts), but there is no mechanism to toggle, persist, or apply the dark theme to the UI.
Additionally, on Electron platforms with Window Controls Overlay (Windows/macOS), the title bar caption controls initially derived their color palette directly from the OS theme (nativeTheme.shouldUseDarkColors). Because the frontend application document never applied the .dark class, a dark OS theme caused a visual mismatch where the caption buttons rendered dark while the rest of the application remained light.
This issue tracks end-to-end theme support (Light / Dark / System) across the renderer and Electron main process.
Current State & Codebase Research
-
CSS Variables & Tokens:
frontend/src/app/globals.csslines 229–260 define the complete OKLCH dark palette for all UI tokens (--background,--foreground,--card,--sidebar,--border,--muted, etc.).@custom-variant dark (&:is(.dark *));is already set up for Tailwind v4.
-
Window Controls Overlay (Electron Main Process):
main/title-bar-theme.tsdefinesTITLE_BAR_OVERLAY_COLORSforlight(#ffffff/#0a0a0a) anddark(#0a0a0a/#fafafa).applyTitleBarOverlayTheme(win, isDark)andattachTitleBarThemeSync(nativeTheme, getWindow)already support dynamic title bar updates at runtime for Windows and macOS.main/index.tscurrently pinsisDark: falseto avoid mismatch until the renderer theme engine is active.
-
Settings & Persistence:
- Allowed wildcard settings keys are defined in
main/routes/settings.ts(ALLOWED_WILDCARD_KEYS) andmain/ipc.ts(ALLOWED_IPC_KEYS).theme/theme_modeis not yet registered.
- Allowed wildcard settings keys are defined in
Architecture & Technical Requirements
1. Settings Key & Persistence (main/ & Database)
- Register
theme_mode('light' | 'dark' | 'system') as an allowed key in:main/routes/settings.ts(ALLOWED_WILDCARD_KEYS)main/ipc.ts(ALLOWED_IPC_KEYS)
- Default value:
'system'(or'light').
2. Frontend Theme Management (frontend/src/)
- Create a dedicated
ThemeProviderorThemeSynccomponent (similar pattern toHtmlLangSync.tsx):- Listen for the active
theme_modepreference from settings. - When set to
'system', listen towindow.matchMedia('(prefers-color-scheme: dark)'). - Toggle the
.darkclass ondocument.documentElement(<html>). - Broadcast the effective theme mode (
lightvsdark) to Electron main process via IPC so native chrome stays synchronized.
- Listen for the active
3. IPC & Title Bar Synchronization (main/ + frontend/)
- Add an IPC channel (e.g.
set-theme-mode/theme-changed) to notify the main process when the effective theme changes in the renderer. - On theme update:
- Call
applyTitleBarOverlayTheme(mainWindow, isDark)on Windows/macOS. - Update
createMainWindowto use the initial persisted theme setting.
- Call
4. Settings UI (frontend/src/app/(dashboard)/settings/)
- Add an Appearance / Theme section in Settings with:
- Radio options or segmented button: Light, Dark, System / Auto.
- Immediate optimistic update with rollback on failure.
Acceptance Criteria
- Selecting Dark mode applies the
.darkclass to<html>and renders all components in dark palette. - Selecting Light mode removes
.darkand renders standard light theme. - Selecting System dynamically responds to OS
prefers-color-schemechanges. - Electron native title bar caption buttons (
titleBarOverlay) match the active app theme on Windows and macOS. - Theme preference persists across app restarts and database reloads.
- Offline-first operation: No external network calls are required for theme resolution or icon assets.
- Standalone routes (
/kds,/customer-display,/server-standalone) cleanly inherit or support theme settings without layout breakage.
Activity
feat: add Light/Dark/System theme support with title-bar synchronizat…
feat: add Light/Dark/System theme support with title-bar synchronizat…
feat: add Light/Dark/System theme support with title-bar synchronizat…
feat: add Light/Dark/System theme support with title-bar synchronizat…
feat: add Light/Dark/System theme support with title-bar synchronizat…
feat: add Light/Dark/System theme support with title-bar synchronizat…
feat: add Light/Dark/System theme support with title-bar synchronizat…
fix(frontend): real retry delay and theme re-hydration after login (F…
feat: add Light/Dark/System theme support with title-bar synchronizat…
feat: add Light/Dark/System theme support with title-bar synchronizat…
feat: add Light/Dark/System theme support with title-bar synchronizat…
feat: add Light/Dark/System theme support with title-bar synchronizat…
feat: add Light/Dark/System theme support with title-bar synchronizat…
feat: add Light/Dark/System theme support with title-bar synchronizat…
feat: add Light/Dark/System theme support with title-bar synchronizat…
feat: add Light/Dark/System theme support with title-bar synchronizat…
feat: add Light/Dark/System theme support with title-bar synchronizat…
feat: add Light/Dark/System theme support with title-bar synchronizat…
feat: add Light/Dark/System theme support with title-bar synchronizat…
feat: add Light/Dark/System theme support with title-bar synchronizat…
feat: add Light/Dark/System theme support with title-bar synchronizat…
feat: add Light/Dark/System theme support with title-bar synchronizat…
carvalab commentedon Aug 31, 2026
Implemented in #563. If you see any discrepancy, please let me know to improve. Thanks.