fix: prevent flash of white theme on VS Code startup#308047
Draft
Mohamed998788 wants to merge 1 commit intomicrosoft:mainfrom
Draft
fix: prevent flash of white theme on VS Code startup#308047Mohamed998788 wants to merge 1 commit intomicrosoft:mainfrom
Mohamed998788 wants to merge 1 commit intomicrosoft:mainfrom
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.
Problem:
When opening VS Code, a brief white/light theme flash (FOUC - Flash of Unstyled Content) occurs during the splash screen loading phase. This is especially jarring for users with dark theme preferences, as they see a bright white screen for a second before the workbench loads the correct theme.
Cause:
The initial shell colors in the renderer process were defaulting to white because the stored user theme data (background/foreground) wasn't available early enough in the configuration or was being ignored if auto-detection was disabled.
Solution:
Synchronized the stored theme preference from the Main process to the Renderer process during window initialization.
Changes:
themeMainServiceImpl.ts: Added getStoredThemeData() to retrieve the last used theme's colors from the state service.
window.ts: Extended INativeWindowConfiguration to include storedThemeData.
windowImpl.ts: Populated the window configuration with the stored theme colors before launching the renderer.
workbench.ts: Updated the splash screen logic to use the storedThemeData as a reliable fallback, ensuring the correct background color is applied to the body immediately.
Result:
The splash screen now correctly matches the user's saved theme (Dark, Light, or High Contrast) from the very first millisecond of startup.