Skip to content

fix: prevent flash of white theme on VS Code startup#308047

Draft
Mohamed998788 wants to merge 1 commit intomicrosoft:mainfrom
Mohamed998788:fix/theme-flash-on-startup
Draft

fix: prevent flash of white theme on VS Code startup#308047
Mohamed998788 wants to merge 1 commit intomicrosoft:mainfrom
Mohamed998788:fix/theme-flash-on-startup

Conversation

@Mohamed998788
Copy link
Copy Markdown

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants