summarylogtreecommitdiffstats
path: root/transparent.diff
blob: 703d3134cf4375ab447cd2590abeea47f533a6f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
diff --git a/src/main.js b/src/main.js
--- a/src/main.js
+++ b/src/main.js
@@ -157,6 +157,10 @@ 			}
		}
	});
 
+	// enable transparent
+	app.commandLine.appendSwitch('enable-transparent-visuals');
+	app.commandLine.appendSwitch('use-gl', 'desktop');
+
 	// Support JS Flags
 	const jsFlags = getJSFlags(cliArgs);
 	if (jsFlags) {
diff --git a/src/vs/platform/theme/electron-main/themeMainService.ts b/src/vs/platform/theme/electron-main/themeMainService.ts
index 189811d6fdf..d10bd05bced 100644
--- a/src/vs/platform/theme/electron-main/themeMainService.ts
+++ b/src/vs/platform/theme/electron-main/themeMainService.ts
@@ -3,7 +3,7 @@
  *  Licensed under the MIT License. See License.txt in the project root for license information.
  *--------------------------------------------------------------------------------------------*/
 
-import { BrowserWindow, nativeTheme } from 'electron';
+import { nativeTheme } from 'electron';
 import { Emitter, Event } from 'vs/base/common/event';
 import { Disposable } from 'vs/base/common/lifecycle';
 import { isLinux, isMacintosh, isWindows } from 'vs/base/common/platform';
@@ -68,19 +68,6 @@ export class ThemeMainService implements IThemeMainService {
 			{ key: THEME_WINDOW_SPLASH, data: splash }
 		]);
 
-		// Update in opened windows
-		if (typeof windowId === 'number') {
-			this.updateBackgroundColor(windowId, splash);
-		}
-	}
-
-	private updateBackgroundColor(windowId: number, splash: IPartsSplash): void {
-		for (const window of BrowserWindow.getAllWindows()) {
-			if (window.id === windowId) {
-				window.setBackgroundColor(splash.colorInfo.background);
-				break;
-			}
-		}
 	}
 
 	getWindowSplash(): IPartsSplash | undefined {
diff --git a/src/vs/platform/windows/electron-main/windowImpl.ts b/src/vs/platform/windows/electron-main/windowImpl.ts
--- a/src/vs/platform/windows/electron-main/windowImpl.ts
+++ b/src/vs/platform/windows/electron-main/windowImpl.ts
@@ -208,7 +208,8 @@					width: this.windowState.width,
 				height: this.windowState.height,
 				x: this.windowState.x,
 				y: this.windowState.y,
-				backgroundColor: this.themeMainService.getBackgroundColor(),
+				transparent: true,
+				backgroundColor: '#00000000' || this.themeMainService.getBackgroundColor(),
				minWidth: WindowMinimumSize.WIDTH,
				minHeight: WindowMinimumSize.HEIGHT,
				show: !isFullscreenOrMaximized, // reduce flicker by showing later
diff --git a/src/vs/workbench/common/theme.ts b/src/vs/workbench/common/theme.ts
--- a/src/vs/workbench/common/theme.ts	2020-04-21 11:28:02.140938188 +0800
+++ b/src/vs/workbench/common/theme.ts	2020-04-21 11:36:36.133491755 +0800
@@ -6,23 +6,25 @@
 import { localize } from 'vs/nls';
 import { registerColor, editorBackground, contrastBorder, transparent, editorWidgetBackground, textLinkForeground, lighten, darken, focusBorder, activeContrastBorder, editorWidgetForeground, editorErrorForeground, editorWarningForeground, editorInfoForeground, treeIndentGuidesStroke, errorForeground, listActiveSelectionBackground, listActiveSelectionForeground, editorForeground } from 'vs/platform/theme/common/colorRegistry';
 import { IColorTheme } from 'vs/platform/theme/common/themeService';
-import { Color } from 'vs/base/common/color';
-import { ColorScheme } from 'vs/platform/theme/common/theme';
+import { Color, RGBA } from 'vs/base/common/color';

 // < --- Workbench (not customizable) --- >

-export function WORKBENCH_BACKGROUND(theme: IColorTheme): Color {
-	switch (theme.type) {
-		case ColorScheme.LIGHT:
-			return Color.fromHex('#F3F3F3');
-		case ColorScheme.HIGH_CONTRAST_LIGHT:
-			return Color.fromHex('#FFFFFF');
-		case ColorScheme.HIGH_CONTRAST_DARK:
-			return Color.fromHex('#000000');
-		default:
-			return Color.fromHex('#252526');
-	}
-}
+export const WORKBENCH_BACKGROUND = (theme: IColorTheme) => theme.getColor(
+	registerColor(
+		'workbench.background',
+		{
+			light: '#F3F3F3',
+			hcLight: '#FFFFFF',
+			hcDark: '#000000',
+			dark: '#252526'
+		},
+		localize(
+			'workbenchBackground',
+			'Top-level background color. Not seen unless other elements have a transparent color.'
+		)
+	)
+) || new Color(new RGBA(0, 0, 0, 0));

 // < --- Tabs --- >