Skip to content

feat(ui): default the theme to the system preference - #7

Merged
fiddur merged 1 commit into
developfrom
theme-system-default
Aug 21, 2026
Merged

feat(ui): default the theme to the system preference#7
fiddur merged 1 commit into
developfrom
theme-system-default

Conversation

@fiddur

@fiddur fiddur commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

useTheme fell back to 'light' when there was neither a stored choice nor --dark, so anyone on
a dark desktop got a light diff every time they opened a fresh session.

It now falls back to prefers-color-scheme, and keeps following changes to it for as long as the
reader has not picked a theme themselves — flipping the OS to dark in the evening flips an open diff
with it. Precedence where it was already meaningful is unchanged: a stored choice beats --dark,
which beats the system.

resolveInitialTheme is split out as a pure function so the precedence is unit-tested; the UI
package's vitest setup has no DOM environment, so testing the hook itself would have meant adding
one. 167 tests pass.

Stacked on #6.

🤖 Generated with Claude Code

https://claude.ai/code/session_018PkYQzbsnMihHesafWvXKs

The theme fell back to light when neither a stored choice nor --dark was present, so
readers on a dark desktop got a light diff on every fresh session. It now falls back to
prefers-color-scheme, and follows changes to it for as long as the reader has not picked
a theme themselves.

Precedence is unchanged where it was already meaningful: a stored choice wins over
--dark, which wins over the system.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018PkYQzbsnMihHesafWvXKs
@fiddur
fiddur changed the base branch from pr-base-oid to develop August 21, 2026 13:34
@fiddur
fiddur marked this pull request as ready for review August 21, 2026 13:34
@fiddur
fiddur merged commit 29233ae into develop Aug 21, 2026
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