Sessions goes black on Reload (fix #305568) (#306742)

* Sessions goes black on Reload (fix #305568)

* Update src/vs/sessions/electron-browser/sessions.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* ccr

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Benjamin Pasero
2026-03-31 16:15:13 +02:00
committed by GitHub
parent e98b050ee0
commit 0e2d1c5a1d

View File

@@ -25,9 +25,48 @@
function showSplash(configuration: INativeWindowConfiguration) {
performance.mark('code/willShowPartsSplash');
const baseTheme = 'vs-dark';
const shellBackground = '#191A1B';
const shellForeground = '#CCCCCC';
let data = configuration.partsSplash;
if (data) {
if (configuration.autoDetectHighContrast && configuration.colorScheme.highContrast) {
if ((configuration.colorScheme.dark && data.baseTheme !== 'hc-black') || (!configuration.colorScheme.dark && data.baseTheme !== 'hc-light')) {
data = undefined; // high contrast mode has been turned by the OS -> ignore stored colors and layouts
}
} else if (configuration.autoDetectColorScheme) {
if ((configuration.colorScheme.dark && data.baseTheme !== 'vs-dark') || (!configuration.colorScheme.dark && data.baseTheme !== 'vs')) {
data = undefined; // OS color scheme is tracked and has changed
}
}
}
// minimal color configuration (works with or without persisted data)
let baseTheme = 'vs-dark';
let shellBackground = '#1E1E1E';
let shellForeground = '#CCCCCC';
if (data) {
baseTheme = data.baseTheme;
shellBackground = data.colorInfo.editorBackground ?? data.colorInfo.background;
shellForeground = data.colorInfo.foreground ?? shellForeground;
} else if (configuration.autoDetectHighContrast && configuration.colorScheme.highContrast) {
if (configuration.colorScheme.dark) {
baseTheme = 'hc-black';
shellBackground = '#000000';
shellForeground = '#FFFFFF';
} else {
baseTheme = 'hc-light';
shellBackground = '#FFFFFF';
shellForeground = '#000000';
}
} else if (configuration.autoDetectColorScheme) {
if (configuration.colorScheme.dark) {
baseTheme = 'vs-dark';
shellBackground = '#1E1E1E';
shellForeground = '#CCCCCC';
} else {
baseTheme = 'vs';
shellBackground = '#FFFFFF';
shellForeground = '#000000';
}
}
// Apply base colors
const style = document.createElement('style');
@@ -36,13 +75,13 @@
style.textContent = `body { background-color: ${shellBackground}; color: ${shellForeground}; margin: 0; padding: 0; }`;
// Set zoom level from splash data if available
if (typeof configuration.partsSplash?.zoomLevel === 'number' && typeof preloadGlobals?.webFrame?.setZoomLevel === 'function') {
preloadGlobals.webFrame.setZoomLevel(configuration.partsSplash.zoomLevel);
if (typeof data?.zoomLevel === 'number' && typeof preloadGlobals?.webFrame?.setZoomLevel === 'function') {
preloadGlobals.webFrame.setZoomLevel(data.zoomLevel);
}
const splash = document.createElement('div');
splash.id = 'monaco-parts-splash';
splash.className = baseTheme;
splash.className = baseTheme ?? 'vs-dark';
window.document.body.appendChild(splash);