Skip to content

BACK-795 - Follow the OS color scheme in the web UI until the user picks a theme - #1159

Open
mhrstmnn wants to merge 1 commit into
MrLesk:mainfrom
mhrstmnn:tasks/back-795-theme-follow-os
Open

mhrstmnn wants to merge 1 commit into
MrLesk:mainfrom
mhrstmnn:tasks/back-795-theme-follow-os

Conversation

@mhrstmnn

Copy link
Copy Markdown
Contributor

Summary

The web UI now follows the OS color scheme until the user picks a theme.

  • ThemeContext keeps the OS scheme in state and updates it from a prefers-color-scheme change listener, so an open tab switches live.
  • Only an explicit toggle writes the theme, under the new backlog-theme-choice key. Toggling back to the theme the OS shows removes the key, so the UI follows the OS again. The single toggle button is unchanged.
  • The old backlog-theme key held a theme written on every load, not a real choice, so it is no longer read. Existing users follow the OS after upgrading.
  • The pre-render script in index.html applies the same rule, so the page doesn't flash the wrong theme.

Related Issue or Task

Closes #1158, BACK-795

Task Checklist

  • I have created a corresponding task in backlog/tasks/
  • The task has clear acceptance criteria
  • I have added an implementation plan to the task
  • All acceptance criteria in the task are marked as completed

Testing

  • New src/test/web-theme.test.tsx covers following OS changes, storing nothing on load, pinning, clearing the choice and ignoring the old key. All four cases failed before the change.
  • bun run check:types, bun run check ., bun run build and all 387 web tests pass.
  • Checked live in Brave 1.98.60 through Playwright: emulated OS changes switch the theme without a reload; a pinned theme survives OS changes and a reload; toggling back follows the OS again; an old backlog-theme=dark value is ignored.
  • With the app bundle blocked, the index.html pre-render script alone picks the expected theme for each combination of stored choice and OS scheme.

This branch was successfully deployed

1 active deployment
github-pages — 2bf62844 Deployed Oct 26, 2026 by mhrstmnn via deploy #321
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.

[Bug]: Web UI doesn't follow OS light/dark changes

1 participant