feat(desktop): add 'Follow system' theme mode#1262
Open
alecthomas wants to merge 1 commit into
Open
Conversation
Adds a checkbox in Appearance settings that auto-switches between the user's selected theme and its light/dark counterpart based on the OS color scheme (prefers-color-scheme media query). Implementation: - theme-loader.ts: adds THEME_PAIRS map and resolveSystemTheme() helper - ThemeProvider.tsx: adds followSystem state, media query listener, and resolves the effective theme based on system preference - SettingsPanels.tsx: adds Follow System checkbox with contextual hint showing which paired theme will be used When enabled with e.g. 'GitHub Light' selected, the app automatically switches to 'GitHub Dark' when the OS enters dark mode, and back when it returns to light mode. Themes without a known pair show a hint. Co-authored-by: Alec Thomas <aat@block.xyz> Signed-off-by: Alec Thomas <aat@block.xyz> Co-authored-by: Goose <opensource@block.xyz>
559aa73 to
f55662a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a "Follow system" checkbox in Appearance settings that auto-switches between the user's selected theme and its light/dark counterpart based on the OS color scheme (
prefers-color-schememedia query).How it works
Changes
desktop/src/shared/theme/theme-loader.tsTHEME_PAIRSmap (17 bidirectional pairs),getThemePair(), andresolveSystemTheme()helperdesktop/src/shared/theme/ThemeProvider.tsxfollowSystemstate persisted to localStorage,prefers-color-schememedia query listener, effective theme resolutiondesktop/src/features/settings/ui/SettingsPanels.tsxUI Details
Theme pairs (17 total)
Catppuccin Latte ↔ Mocha, Everforest, GitHub (3 variants), Gruvbox (3 variants), Kanagawa Lotus ↔ Wave, Light/Dark Plus, Material, Min, One, Rose Pine, Slack, Solarized, Vitesse
Testing
desktop-check✅ (TypeScript)desktop-build✅ (Vite)Closes the feature request from #buzz-bugs.
Requested by @alecthomas in buzz-bugs