diff --git a/src/vs/workbench/services/themes/browser/workbenchThemeService.ts b/src/vs/workbench/services/themes/browser/workbenchThemeService.ts index 0ae7e479016c7..ea58be56b01f4 100644 --- a/src/vs/workbench/services/themes/browser/workbenchThemeService.ts +++ b/src/vs/workbench/services/themes/browser/workbenchThemeService.ts @@ -6,7 +6,7 @@ import * as nls from 'vs/nls'; import * as types from 'vs/base/common/types'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; -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'; +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'; import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { Registry } from 'vs/platform/registry/common/platform'; @@ -143,7 +143,8 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { // themes are loaded asynchronously, we need to initialize // a color theme document with good defaults until the theme is loaded let themeData: ColorThemeData | undefined = ColorThemeData.fromStorageData(this.storageService); - if (themeData && this.settings.colorTheme !== themeData.settingsId && this.settings.isDefaultColorTheme()) { + const colorThemeSetting = this.settings.colorTheme; + if (themeData && colorThemeSetting !== themeData.settingsId && this.settings.isDefaultColorTheme()) { this.hasDefaultUpdated = themeData.settingsId === ThemeSettingDefaults.COLOR_THEME_DARK_OLD || themeData.settingsId === ThemeSettingDefaults.COLOR_THEME_LIGHT_OLD; // 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 { // the preferred color scheme (high contrast, light, dark) has changed since the last start const preferredColorScheme = this.getPreferredColorScheme(); + const defaultColorMap = colorThemeSetting === ThemeSettingDefaults.COLOR_THEME_LIGHT ? COLOR_THEME_LIGHT_INITIAL_COLORS : colorThemeSetting === ThemeSettingDefaults.COLOR_THEME_DARK ? COLOR_THEME_DARK_INITIAL_COLORS : undefined; if (preferredColorScheme && themeData?.type !== preferredColorScheme && this.storageService.get(PERSISTED_OS_COLOR_SCHEME, PERSISTED_OS_COLOR_SCHEME_SCOPE) !== preferredColorScheme) { - themeData = ColorThemeData.createUnloadedThemeForThemeType(preferredColorScheme); + themeData = ColorThemeData.createUnloadedThemeForThemeType(preferredColorScheme, undefined); } if (!themeData) { const initialColorTheme = environmentService.options?.initialColorTheme; if (initialColorTheme) { - themeData = ColorThemeData.createUnloadedThemeForThemeType(initialColorTheme.themeType, initialColorTheme.colors); + themeData = ColorThemeData.createUnloadedThemeForThemeType(initialColorTheme.themeType, initialColorTheme.colors ?? defaultColorMap); } } if (!themeData) { - themeData = ColorThemeData.createUnloadedThemeForThemeType(isWeb ? ColorScheme.LIGHT : ColorScheme.DARK); + themeData = ColorThemeData.createUnloadedThemeForThemeType(isWeb ? ColorScheme.LIGHT : ColorScheme.DARK, defaultColorMap); } themeData.setCustomizations(this.settings); this.applyTheme(themeData, undefined, true); diff --git a/src/vs/workbench/services/themes/common/colorThemeData.ts b/src/vs/workbench/services/themes/common/colorThemeData.ts index 257a77e705194..c498d6c4da4a8 100644 --- a/src/vs/workbench/services/themes/common/colorThemeData.ts +++ b/src/vs/workbench/services/themes/common/colorThemeData.ts @@ -587,22 +587,6 @@ export class ColorThemeData implements IWorkbenchColorTheme { // constructors static createUnloadedThemeForThemeType(themeType: ColorScheme, colorMap?: { [id: string]: string }): ColorThemeData { - if (!colorMap) { - if (themeType === ColorScheme.LIGHT) { - colorMap = { - 'activityBar.background': '#f8f8f8', - 'statusBar.background': '#f8f8f8', - 'statusBar.noFolderBackground': '#f8f8f8' - }; - } else { - colorMap = { - 'activityBar.background': '#181818', - 'statusBar.background': '#181818', - 'statusBar.noFolderBackground': '#1f1f1f', - }; - } - - } return ColorThemeData.createUnloadedTheme(getThemeTypeSelector(themeType), colorMap); } diff --git a/src/vs/workbench/services/themes/common/workbenchThemeService.ts b/src/vs/workbench/services/themes/common/workbenchThemeService.ts index b375061018091..22ebde5b0b802 100644 --- a/src/vs/workbench/services/themes/common/workbenchThemeService.ts +++ b/src/vs/workbench/services/themes/common/workbenchThemeService.ts @@ -50,9 +50,21 @@ export enum ThemeSettingDefaults { COLOR_THEME_LIGHT_OLD = 'Default Light+', FILE_ICON_THEME = 'vs-seti', - PRODUCT_ICON_THEME = 'Default' + PRODUCT_ICON_THEME = 'Default', } +export const COLOR_THEME_DARK_INITIAL_COLORS = { + 'activityBar.background': '#181818', + 'statusBar.background': '#181818', + 'statusBar.noFolderBackground': '#1f1f1f', +}; + +export const COLOR_THEME_LIGHT_INITIAL_COLORS = { + 'activityBar.background': '#f8f8f8', + 'statusBar.background': '#f8f8f8', + 'statusBar.noFolderBackground': '#f8f8f8' +}; + export interface IWorkbenchTheme { readonly id: string; readonly label: string;