6
6
import * as nls from 'vs/nls' ;
7
7
import * as types from 'vs/base/common/types' ;
8
8
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions' ;
9
- import { IWorkbenchThemeService , IWorkbenchColorTheme , IWorkbenchFileIconTheme , ExtensionData , VS_LIGHT_THEME , VS_DARK_THEME , VS_HC_THEME , VS_HC_LIGHT_THEME , ThemeSettings , IWorkbenchProductIconTheme , ThemeSettingTarget , ThemeSettingDefaults } from 'vs/workbench/services/themes/common/workbenchThemeService' ;
9
+ import { IWorkbenchThemeService , IWorkbenchColorTheme , IWorkbenchFileIconTheme , ExtensionData , VS_LIGHT_THEME , VS_DARK_THEME , VS_HC_THEME , VS_HC_LIGHT_THEME , ThemeSettings , IWorkbenchProductIconTheme , ThemeSettingTarget , ThemeSettingDefaults , COLOR_THEME_DARK_INITIAL_COLORS , COLOR_THEME_LIGHT_INITIAL_COLORS } from 'vs/workbench/services/themes/common/workbenchThemeService' ;
10
10
import { IStorageService , StorageScope , StorageTarget } from 'vs/platform/storage/common/storage' ;
11
11
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry' ;
12
12
import { Registry } from 'vs/platform/registry/common/platform' ;
@@ -143,7 +143,8 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
143
143
// themes are loaded asynchronously, we need to initialize
144
144
// a color theme document with good defaults until the theme is loaded
145
145
let themeData : ColorThemeData | undefined = ColorThemeData . fromStorageData ( this . storageService ) ;
146
- if ( themeData && this . settings . colorTheme !== themeData . settingsId && this . settings . isDefaultColorTheme ( ) ) {
146
+ const colorThemeSetting = this . settings . colorTheme ;
147
+ if ( themeData && colorThemeSetting !== themeData . settingsId && this . settings . isDefaultColorTheme ( ) ) {
147
148
this . hasDefaultUpdated = themeData . settingsId === ThemeSettingDefaults . COLOR_THEME_DARK_OLD || themeData . settingsId === ThemeSettingDefaults . COLOR_THEME_LIGHT_OLD ;
148
149
149
150
// the web has different defaults than the desktop, therefore do not restore when the setting is the default theme and the storage doesn't match that.
@@ -152,18 +153,19 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
152
153
153
154
// the preferred color scheme (high contrast, light, dark) has changed since the last start
154
155
const preferredColorScheme = this . getPreferredColorScheme ( ) ;
156
+ const defaultColorMap = colorThemeSetting === ThemeSettingDefaults . COLOR_THEME_LIGHT ? COLOR_THEME_LIGHT_INITIAL_COLORS : colorThemeSetting === ThemeSettingDefaults . COLOR_THEME_DARK ? COLOR_THEME_DARK_INITIAL_COLORS : undefined ;
155
157
156
158
if ( preferredColorScheme && themeData ?. type !== preferredColorScheme && this . storageService . get ( PERSISTED_OS_COLOR_SCHEME , PERSISTED_OS_COLOR_SCHEME_SCOPE ) !== preferredColorScheme ) {
157
- themeData = ColorThemeData . createUnloadedThemeForThemeType ( preferredColorScheme ) ;
159
+ themeData = ColorThemeData . createUnloadedThemeForThemeType ( preferredColorScheme , undefined ) ;
158
160
}
159
161
if ( ! themeData ) {
160
162
const initialColorTheme = environmentService . options ?. initialColorTheme ;
161
163
if ( initialColorTheme ) {
162
- themeData = ColorThemeData . createUnloadedThemeForThemeType ( initialColorTheme . themeType , initialColorTheme . colors ) ;
164
+ themeData = ColorThemeData . createUnloadedThemeForThemeType ( initialColorTheme . themeType , initialColorTheme . colors ?? defaultColorMap ) ;
163
165
}
164
166
}
165
167
if ( ! themeData ) {
166
- themeData = ColorThemeData . createUnloadedThemeForThemeType ( isWeb ? ColorScheme . LIGHT : ColorScheme . DARK ) ;
168
+ themeData = ColorThemeData . createUnloadedThemeForThemeType ( isWeb ? ColorScheme . LIGHT : ColorScheme . DARK , defaultColorMap ) ;
167
169
}
168
170
themeData . setCustomizations ( this . settings ) ;
169
171
this . applyTheme ( themeData , undefined , true ) ;
0 commit comments