Add 'Waldnacht' dark theme and theme selector (system/light/dark) #1

Merged
Christoph merged 1 commit from feat/dark-theme into main 2026-10-09 23:05:00 +00:00
Owner

This change adds a new dark theme (named “Waldnacht”) and a theme selector that lets users choose system, light or dark. The app now applies a theme at startup, persists the selection to localStorage, updates the document data-theme attribute at runtime, and keeps the browser meta[name="theme-color"] in sync with the current theme.

Key behavior changes

  • User-visible setting: a theme picker was added to the Settings page (uses the SunMoon icon). The select stores the chosen theme and updates the UI immediately.
    • Files: src/App.tsx (imports initialTheme, themeTranslations, themes, adds theme state, adds settings select).
  • Persist and apply on startup: the initial theme is read/applied during app bootstrap and the data-theme attribute is set on document.documentElement when a non-system theme is chosen.
    • Files: src/main.tsx (calls initialTheme() and applies document.documentElement.dataset.theme = theme).
  • Runtime behavior: selecting a theme persists to localStorage key wallpaperflow-theme, sets/removes data-theme for system behavior, and registers a listener for prefers-color-scheme changes to update the page meta[name="theme-color"] to match --shell.
    • Files: src/App.tsx (effect that writes to localStorage, updates dataset and meta theme-color, and listens for prefers-color-scheme changes).
  • CSS refactor & theme tokens: styles were refactored to use CSS custom properties with light defaults and a dark token set. The dark variant is provided both via @media (prefers-color-scheme: dark) (for system-dark) and via :root[data-theme="dark"] (for forced dark). This introduces many theme tokens (e.g. --bg, --shell, --surface, --text, etc.) used across the stylesheet so components respond to the active theme.
    • Files: src/styles.css (new variables, data-theme handling, and many color references switched to variables).
  • Android resource updates: the Android theme resources were updated to set android:windowBackground for night and day values to match the new visual treatment.
    • Files: src-tauri/gen/android/app/src/main/res/values-night/themes.xml and src-tauri/gen/android/app/src/main/res/values/themes.xml (windowBackground values changed).

Notes about scope

  • This is primarily a UI/theme change and a small runtime addition to persist/apply user preference. It does not change business logic outside theming.
  • The result is a coherent theming system that supports: automatic system theme (default), explicit light, or explicit dark, with CSS tokens and an initial application at startup.

Testing

No test execution results were provided.

Recommended manual checks for reviewers

  1. Settings UI
    • Open Settings and confirm the new theme selector is present, shows the current selection, and changing it updates the UI immediately.
  2. Persistence and startup
    • Change theme to dark or light and reload the app; confirm localStorage.getItem("wallpaperflow-theme") contains the selection and the page applies the chosen theme on load (document.documentElement.dataset.theme).
  3. System behavior and meta color
    • Set theme to system, then change OS/browser prefers-color-scheme between light/dark and confirm UI updates accordingly and the page meta[name="theme-color"] reflects the CSS --shell value.
  4. Android background (optional)
    • If building the Android artifact, verify the window background color matches the intended day/night values set in the updated themes.xml files.

Compatibility / reviewer actions

  • No explicit migrations or configuration changes are required for users. The dataset attribute data-theme is applied only when a non-system theme is chosen; otherwise the implementation defers to the OS preference.
  • Reviewers may want to sanity-check CSS variable usage for any components that still hard-code colors and confirm the Android resource changes during an Android build.

If you want, I can list the specific new/changed tokens or point to a small checklist of DOM selectors to inspect while testing.

This change adds a new dark theme (named “Waldnacht”) and a theme selector that lets users choose `system`, `light` or `dark`. The app now applies a theme at startup, persists the selection to localStorage, updates the document `data-theme` attribute at runtime, and keeps the browser `meta[name="theme-color"]` in sync with the current theme. Key behavior changes - User-visible setting: a theme picker was added to the Settings page (uses the `SunMoon` icon). The select stores the chosen theme and updates the UI immediately. - Files: `src/App.tsx` (imports `initialTheme`, `themeTranslations`, `themes`, adds `theme` state, adds settings select). - Persist and apply on startup: the initial theme is read/applied during app bootstrap and the `data-theme` attribute is set on `document.documentElement` when a non-`system` theme is chosen. - Files: `src/main.tsx` (calls `initialTheme()` and applies `document.documentElement.dataset.theme = theme`). - Runtime behavior: selecting a theme persists to `localStorage` key `wallpaperflow-theme`, sets/removes `data-theme` for `system` behavior, and registers a listener for `prefers-color-scheme` changes to update the page `meta[name="theme-color"]` to match `--shell`. - Files: `src/App.tsx` (effect that writes to localStorage, updates dataset and meta theme-color, and listens for `prefers-color-scheme` changes). - CSS refactor & theme tokens: styles were refactored to use CSS custom properties with light defaults and a dark token set. The dark variant is provided both via `@media (prefers-color-scheme: dark)` (for system-dark) and via `:root[data-theme="dark"]` (for forced dark). This introduces many theme tokens (e.g. `--bg`, `--shell`, `--surface`, `--text`, etc.) used across the stylesheet so components respond to the active theme. - Files: `src/styles.css` (new variables, data-theme handling, and many color references switched to variables). - Android resource updates: the Android theme resources were updated to set `android:windowBackground` for night and day values to match the new visual treatment. - Files: `src-tauri/gen/android/app/src/main/res/values-night/themes.xml` and `src-tauri/gen/android/app/src/main/res/values/themes.xml` (windowBackground values changed). Notes about scope - This is primarily a UI/theme change and a small runtime addition to persist/apply user preference. It does not change business logic outside theming. - The result is a coherent theming system that supports: automatic system theme (default), explicit light, or explicit dark, with CSS tokens and an initial application at startup. Testing No test execution results were provided. Recommended manual checks for reviewers 1. Settings UI - Open Settings and confirm the new theme selector is present, shows the current selection, and changing it updates the UI immediately. 2. Persistence and startup - Change theme to `dark` or `light` and reload the app; confirm `localStorage.getItem("wallpaperflow-theme")` contains the selection and the page applies the chosen theme on load (`document.documentElement.dataset.theme`). 3. System behavior and meta color - Set theme to `system`, then change OS/browser `prefers-color-scheme` between light/dark and confirm UI updates accordingly and the page `meta[name="theme-color"]` reflects the CSS `--shell` value. 4. Android background (optional) - If building the Android artifact, verify the window background color matches the intended day/night values set in the updated `themes.xml` files. Compatibility / reviewer actions - No explicit migrations or configuration changes are required for users. The dataset attribute `data-theme` is applied only when a non-`system` theme is chosen; otherwise the implementation defers to the OS preference. - Reviewers may want to sanity-check CSS variable usage for any components that still hard-code colors and confirm the Android resource changes during an Android build. If you want, I can list the specific new/changed tokens or point to a small checklist of DOM selectors to inspect while testing.
Move all stylesheet colors to theme tokens and add a dark palette that
follows the system color scheme. A new Appearance setting lets users
force light or dark; the choice is persisted and applied before the
first render. Android window background now matches day/night.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Christoph/LockScreenWallpaper!1
No description provided.