fix: allow independent light/dark theme selection when following system - #2131
Open
xielixing wants to merge 1 commit into
Open
fix: allow independent light/dark theme selection when following system#2131xielixing wants to merge 1 commit into
xielixing wants to merge 1 commit into
Conversation
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
When "Match system" is selected as the theme, users can now independently choose which light theme and which dark theme the system mode uses. Previously, system mode always fell back to the hardcoded defaults (
bitfun-light/bitfun-dark).Closes #1080
Changes
presets/index.ts:getSystemPreferredDefaultThemeId()now accepts optionallightId/darkIdoverride parameters, falling back to the built-in defaults when not provided.ThemeService.ts: AddedsystemLightId/systemDarkIdfields with lazy loading fromthemes.systemLightId/themes.systemDarkIdconfig paths. AddedsetSystemThemeOverride()method that persists overrides and re-resolves the active theme if system mode is active. All three call sites ofgetSystemPreferredDefaultThemeId()now pass the user-configured overrides.themeStore.ts: AddedsystemLightId/systemDarkIdstate andsetSystemThemeOverrideaction that delegates tothemeService.useTheme.ts: ExposedsystemLightId,systemDarkId, andsetSystemThemeOverridefrom the hook.AppearanceConfig.tsx: Added two conditionalSelectdropdowns (light themes / dark themes) that appear only when "Match system" is selected, letting users pick independent light/dark themes.en-US,zh-CN, andzh-TWlocale files.Design decisions
themes.*namespace convention (themes.systemLightId,themes.systemDarkId).Validation
tsc --noEmit— 0 errorsvitest run src/infrastructure/theme— 37/37 tests passedpnpm run i18n:audit— 0 warnings