Skip to content

Let the user choose a light, dark or system theme - #10

Merged
Torgh merged 1 commit into
mainfrom
theme-choice
Oct 16, 2026
Merged

Torgh merged 1 commit into
mainfrom
theme-choice

Conversation

@Torgh

@Torgh Torgh commented Oct 16, 2026

Copy link
Copy Markdown
Owner

Summary

Settings → Appearance now offers 🖥️ System (default, the previous behaviour), ☀️ Light and 🌙 Dark.

  • Saved per browser (localStorage), applied by an inline <head> script before the first paint – no flash of the wrong theme on reload, as in Next's Preventing flash before hydration guide. ThemeAgent re-applies it after React's dev-mode remount.
  • Colour tokens in globals.css now use light-dark(light, dark); data-theme on <html> only sets color-scheme, so every colour is still defined once.
  • The Google map is created in the chosen scheme (it only reads the scheme at creation, so it is re-created on change). The OpenStreetMap map keeps its light style, as before.
  • The printable itinerary stays light whatever the theme.
  • Other tabs and OS light/dark switches are picked up live.

lib/theme.ts holds the pure parts (tested); lib/useTheme.ts the browser hooks, excluded from coverage like lib/hooks.ts.

Test plan

  • bun run typecheck, lint, test:coverage (169 tests), build
  • In Chrome (Playwright): Dark applies at once and survives a reload, also with the app's JS blocked (the <head> script alone sets it); Light wins over a dark OS; System follows the OS and clears the saved value
  • Trip board and Google map in dark mode

🤖 Generated with Claude Code

Settings → Appearance offers System (the default, as before), Light and
Dark. The choice is saved per browser and applied by an inline <head>
script before the first paint, so a reload never flashes the other theme.

- colour tokens use light-dark(); data-theme on <html> only sets
  color-scheme, so each colour is defined once
- the Google map is created in the chosen scheme; the printable
  itinerary stays light
- other tabs and OS theme changes are picked up live

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Torgh
Torgh merged commit 1124367 into main Oct 16, 2026
2 checks passed
@Torgh
Torgh deleted the theme-choice branch October 16, 2026 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant