@@ -9,6 +9,7 @@ import * as path from 'path';
99import * as platform from 'vs/base/common/platform' ;
1010import * as objects from 'vs/base/common/objects' ;
1111import nls = require( 'vs/nls' ) ;
12+ import { IStorageService } from 'vs/code/electron-main/storage' ;
1213import { shell , screen , BrowserWindow , systemPreferences , app } from 'electron' ;
1314import { TPromise , TValueCallback } from 'vs/base/common/winjs.base' ;
1415import { IEnvironmentService , ParsedArgs } from 'vs/platform/environment/common/environment' ;
@@ -20,6 +21,7 @@ import { getCommonHTTPHeaders } from 'vs/platform/environment/node/http';
2021import { IWindowSettings , MenuBarVisibility } from 'vs/platform/windows/common/windows' ;
2122import { IDisposable , dispose } from 'vs/base/common/lifecycle' ;
2223
24+
2325export interface IWindowState {
2426 width ?: number ;
2527 height ?: number ;
@@ -134,6 +136,8 @@ export interface IVSCodeWindow {
134136
135137export class VSCodeWindow implements IVSCodeWindow {
136138
139+ public static baseThemeStorageKey = 'baseTheme' ;
140+
137141 private static MIN_WIDTH = 200 ;
138142 private static MIN_HEIGHT = 120 ;
139143
@@ -160,7 +164,8 @@ export class VSCodeWindow implements IVSCodeWindow {
160164 config : IWindowCreationOptions ,
161165 @ILogService private logService : ILogService ,
162166 @IEnvironmentService private environmentService : IEnvironmentService ,
163- @IConfigurationService private configurationService : IConfigurationService
167+ @IConfigurationService private configurationService : IConfigurationService ,
168+ @IStorageService private storageService : IStorageService
164169 ) {
165170 this . options = config ;
166171 this . _lastFocusTime = - 1 ;
@@ -174,9 +179,9 @@ export class VSCodeWindow implements IVSCodeWindow {
174179 this . restoreWindowState ( config . state ) ;
175180
176181 // For VS theme we can show directly because background is white
177- const themeId = this . configurationService . lookup < string > ( 'workbench.colorTheme' ) . value ;
178- const usesLightTheme = / ^ l - / . test ( themeId ) ;
179- const usesHighContrastTheme = / ^ h c - / . test ( themeId ) || ( platform . isWindows && systemPreferences . isInvertedColorScheme ( ) ) ;
182+ const baseTheme = this . storageService . getItem < string > ( VSCodeWindow . baseThemeStorageKey ) ;
183+ const usesLightTheme = 'vs' === baseTheme ;
184+ const usesHighContrastTheme = ' hc-black' === baseTheme || ( platform . isWindows && systemPreferences . isInvertedColorScheme ( ) ) ;
180185
181186 // in case we are maximized or fullscreen, only show later after the call to maximize/fullscreen (see below)
182187 const isFullscreenOrMaximized = ( this . currentWindowMode === WindowMode . Maximized || this . currentWindowMode === WindowMode . Fullscreen ) ;
@@ -503,14 +508,8 @@ export class VSCodeWindow implements IVSCodeWindow {
503508 windowConfiguration . accessibilitySupport = app . isAccessibilitySupportEnabled ( ) ;
504509
505510 // background color
506- const themeId = this . configurationService . lookup < string > ( 'workbench.colorTheme' ) . value ;
507- if ( themeId [ 0 ] === 'h' ) {
508- windowConfiguration . baseTheme = 'hc-black' ;
509- } else if ( themeId [ 0 ] === 'l' ) {
510- windowConfiguration . baseTheme = 'vs' ;
511- } else {
512- windowConfiguration . baseTheme = 'vs-dark' ;
513- }
511+ const baseTheme = this . storageService . getItem < string > ( VSCodeWindow . baseThemeStorageKey , 'vs-dark' ) ;
512+ windowConfiguration . baseTheme = baseTheme ;
514513
515514 // Perf Counters
516515 windowConfiguration . perfStartTime = global . perfStartTime ;
0 commit comments