Skip to content

fix(themes): sync preferred theme settings when workbench.colorTheme changes#309182

Open
yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
yogeshwaran-c:fix/theme-toggle-syncs-preferred-theme
Open

fix(themes): sync preferred theme settings when workbench.colorTheme changes#309182
yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
yogeshwaran-c:fix/theme-toggle-syncs-preferred-theme

Conversation

@yogeshwaran-c
Copy link
Copy Markdown
Contributor

Upstream fix for #305685

Problem

Using Toggle between Light/Dark Themes resets the theme to VS Code defaults (VSCode Dark / VSCode Light) instead of returning to the user's previously-selected theme.

Root Cause

The toggle command reads workbench.preferredDarkColorTheme / workbench.preferredLightColorTheme to decide which theme to apply. If the user never explicitly configured those settings they contain the default value, so the toggle always switches to the default rather than the theme the user was using.

Fix

In installConfigurationListener, when workbench.colorTheme changes and auto-detect is not active, keep the matching preferred-theme setting in sync:

  • If the new theme is dark, update workbench.preferredDarkColorTheme to match.
  • If the new theme is light, update workbench.preferredLightColorTheme to match.

This ensures the toggle always returns to the user's most recently used dark or light theme. The guard current !== newSettingId prevents redundant writes (e.g. when the toggle itself sets workbench.colorTheme).

When the user changes `workbench.colorTheme`, also update
`workbench.preferredDarkColorTheme` or `workbench.preferredLightColorTheme`
so that the 'Toggle between Light/Dark Themes' command returns to the
user's most recently used theme instead of reverting to the default.

Fixes microsoft#305685
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.

2 participants