diff --git a/extensions/theme-defaults/package.json b/extensions/theme-defaults/package.json index f7e58ccea08..a73e2654255 100644 --- a/extensions/theme-defaults/package.json +++ b/extensions/theme-defaults/package.json @@ -9,26 +9,31 @@ "contributes": { "themes": [ { + "id": "Default Dark+", "label": "Dark+ (default dark)", "uiTheme": "vs-dark", "path": "./themes/dark_plus.json" }, { + "id": "Default Light+", "label": "Light+ (default light)", "uiTheme": "vs", "path": "./themes/light_plus.json" }, { + "id": "Visual Studio Dark", "label": "Dark (Visual Studio)", "uiTheme": "vs-dark", "path": "./themes/dark_vs.json" }, { + "id": "Visual Studio Light", "label": "Light (Visual Studio)", "uiTheme": "vs", "path": "./themes/light_vs.json" }, { + "id": "Default High Contrast", "label": "High Contrast", "uiTheme": "hc-black", "path": "./themes/hc_black.json" diff --git a/src/vs/code/electron-main/window.ts b/src/vs/code/electron-main/window.ts index c2e21b77c1b..22f0ab90365 100644 --- a/src/vs/code/electron-main/window.ts +++ b/src/vs/code/electron-main/window.ts @@ -9,7 +9,6 @@ import * as path from 'path'; import * as platform from 'vs/base/common/platform'; import * as objects from 'vs/base/common/objects'; import nls = require('vs/nls'); -import { IStorageService } from 'vs/code/electron-main/storage'; import { shell, screen, BrowserWindow, systemPreferences, app } from 'electron'; import { TPromise, TValueCallback } from 'vs/base/common/winjs.base'; import { IEnvironmentService, ParsedArgs } from 'vs/platform/environment/common/environment'; @@ -78,6 +77,7 @@ export interface IWindowConfiguration extends ParsedArgs { zoomLevel?: number; fullscreen?: boolean; highContrast?: boolean; + baseTheme?: string; accessibilitySupport?: boolean; isInitialStartup?: boolean; @@ -134,8 +134,6 @@ export interface IVSCodeWindow { export class VSCodeWindow implements IVSCodeWindow { - public static colorThemeStorageKey = 'theme'; - private static MIN_WIDTH = 200; private static MIN_HEIGHT = 120; @@ -162,8 +160,7 @@ export class VSCodeWindow implements IVSCodeWindow { config: IWindowCreationOptions, @ILogService private logService: ILogService, @IEnvironmentService private environmentService: IEnvironmentService, - @IConfigurationService private configurationService: IConfigurationService, - @IStorageService private storageService: IStorageService + @IConfigurationService private configurationService: IConfigurationService ) { this.options = config; this._lastFocusTime = -1; @@ -177,9 +174,9 @@ export class VSCodeWindow implements IVSCodeWindow { this.restoreWindowState(config.state); // For VS theme we can show directly because background is white - const themeId = this.storageService.getItem(VSCodeWindow.colorThemeStorageKey); - const usesLightTheme = /vs($| )/.test(themeId); - const usesHighContrastTheme = /hc-black($| )/.test(themeId) || (platform.isWindows && systemPreferences.isInvertedColorScheme()); + const themeId = this.configurationService.lookup('workbench.colorTheme').value; + const usesLightTheme = /^l-/.test(themeId); + const usesHighContrastTheme = /^hc-/.test(themeId) || (platform.isWindows && systemPreferences.isInvertedColorScheme()); // in case we are maximized or fullscreen, only show later after the call to maximize/fullscreen (see below) const isFullscreenOrMaximized = (this.currentWindowMode === WindowMode.Maximized || this.currentWindowMode === WindowMode.Fullscreen); @@ -505,6 +502,16 @@ export class VSCodeWindow implements IVSCodeWindow { windowConfiguration.highContrast = platform.isWindows && systemPreferences.isInvertedColorScheme() && (!windowConfig || windowConfig.autoDetectHighContrast); windowConfiguration.accessibilitySupport = app.isAccessibilitySupportEnabled(); + // background color + const themeId = this.configurationService.lookup('workbench.colorTheme').value; + if (themeId[0] === 'h') { + windowConfiguration.baseTheme = 'hc-black'; + } else if (themeId[0] === 'l') { + windowConfiguration.baseTheme = 'vs'; + } else { + windowConfiguration.baseTheme = 'vs-dark'; + } + // Perf Counters windowConfiguration.perfStartTime = global.perfStartTime; windowConfiguration.perfAppReady = global.perfAppReady; diff --git a/src/vs/code/electron-main/windows.ts b/src/vs/code/electron-main/windows.ts index a50e2993692..2f53dc8cc0b 100644 --- a/src/vs/code/electron-main/windows.ts +++ b/src/vs/code/electron-main/windows.ts @@ -289,13 +289,7 @@ export class WindowsManager implements IWindowsMainService { } private onBroadcast(event: string, payload: any): void { - - // Theme changes - if (event === 'vscode:changeColorTheme' && typeof payload === 'string') { - this.storageService.setItem(VSCodeWindow.colorThemeStorageKey, payload); - } } - public reload(win: VSCodeWindow, cli?: ParsedArgs): void { // Only reload when the window has not vetoed this @@ -530,7 +524,7 @@ export class WindowsManager implements IWindowsMainService { const mru = this.getRecentPathsList(); paths.forEach(p => { - const {path, isFile} = p; + const { path, isFile } = p; if (isFile) { mru.files.unshift(path); @@ -794,8 +788,7 @@ export class WindowsManager implements IWindowsMainService { }, this.logService, this.environmentService, - this.configurationService, - this.storageService + this.configurationService ); WindowsManager.WINDOWS.push(vscodeWindow); diff --git a/src/vs/workbench/electron-browser/bootstrap/index.html b/src/vs/workbench/electron-browser/bootstrap/index.html index 73cc8d4c91d..cd7041e6db5 100644 --- a/src/vs/workbench/electron-browser/bootstrap/index.html +++ b/src/vs/workbench/electron-browser/bootstrap/index.html @@ -16,13 +16,8 @@