|
25 | 25 | function showSplash(configuration: INativeWindowConfiguration) { |
26 | 26 | performance.mark('code/willShowPartsSplash'); |
27 | 27 |
|
28 | | - const baseTheme = 'vs-dark'; |
29 | | - const shellBackground = '#191A1B'; |
30 | | - const shellForeground = '#CCCCCC'; |
| 28 | + let data = configuration.partsSplash; |
| 29 | + if (data) { |
| 30 | + if (configuration.autoDetectHighContrast && configuration.colorScheme.highContrast) { |
| 31 | + if ((configuration.colorScheme.dark && data.baseTheme !== 'hc-black') || (!configuration.colorScheme.dark && data.baseTheme !== 'hc-light')) { |
| 32 | + data = undefined; // high contrast mode has been turned by the OS -> ignore stored colors and layouts |
| 33 | + } |
| 34 | + } else if (configuration.autoDetectColorScheme) { |
| 35 | + if ((configuration.colorScheme.dark && data.baseTheme !== 'vs-dark') || (!configuration.colorScheme.dark && data.baseTheme !== 'vs')) { |
| 36 | + data = undefined; // OS color scheme is tracked and has changed |
| 37 | + } |
| 38 | + } |
| 39 | + } |
| 40 | + |
| 41 | + // minimal color configuration (works with or without persisted data) |
| 42 | + let baseTheme = 'vs-dark'; |
| 43 | + let shellBackground = '#1E1E1E'; |
| 44 | + let shellForeground = '#CCCCCC'; |
| 45 | + if (data) { |
| 46 | + baseTheme = data.baseTheme; |
| 47 | + shellBackground = data.colorInfo.editorBackground ?? data.colorInfo.background; |
| 48 | + shellForeground = data.colorInfo.foreground ?? shellForeground; |
| 49 | + } else if (configuration.autoDetectHighContrast && configuration.colorScheme.highContrast) { |
| 50 | + if (configuration.colorScheme.dark) { |
| 51 | + baseTheme = 'hc-black'; |
| 52 | + shellBackground = '#000000'; |
| 53 | + shellForeground = '#FFFFFF'; |
| 54 | + } else { |
| 55 | + baseTheme = 'hc-light'; |
| 56 | + shellBackground = '#FFFFFF'; |
| 57 | + shellForeground = '#000000'; |
| 58 | + } |
| 59 | + } else if (configuration.autoDetectColorScheme) { |
| 60 | + if (configuration.colorScheme.dark) { |
| 61 | + baseTheme = 'vs-dark'; |
| 62 | + shellBackground = '#1E1E1E'; |
| 63 | + shellForeground = '#CCCCCC'; |
| 64 | + } else { |
| 65 | + baseTheme = 'vs'; |
| 66 | + shellBackground = '#FFFFFF'; |
| 67 | + shellForeground = '#000000'; |
| 68 | + } |
| 69 | + } |
31 | 70 |
|
32 | 71 | // Apply base colors |
33 | 72 | const style = document.createElement('style'); |
|
36 | 75 | style.textContent = `body { background-color: ${shellBackground}; color: ${shellForeground}; margin: 0; padding: 0; }`; |
37 | 76 |
|
38 | 77 | // Set zoom level from splash data if available |
39 | | - if (typeof configuration.partsSplash?.zoomLevel === 'number' && typeof preloadGlobals?.webFrame?.setZoomLevel === 'function') { |
40 | | - preloadGlobals.webFrame.setZoomLevel(configuration.partsSplash.zoomLevel); |
| 78 | + if (typeof data?.zoomLevel === 'number' && typeof preloadGlobals?.webFrame?.setZoomLevel === 'function') { |
| 79 | + preloadGlobals.webFrame.setZoomLevel(data.zoomLevel); |
41 | 80 | } |
42 | 81 |
|
43 | 82 | const splash = document.createElement('div'); |
44 | 83 | splash.id = 'monaco-parts-splash'; |
45 | | - splash.className = baseTheme; |
| 84 | + splash.className = baseTheme ?? 'vs-dark'; |
46 | 85 |
|
47 | 86 | window.document.body.appendChild(splash); |
48 | 87 |
|
|
0 commit comments