diff --git a/extensions/theme-defaults/package.nls.json b/extensions/theme-defaults/package.nls.json index bcb5691a95b..d96a488ae59 100644 --- a/extensions/theme-defaults/package.nls.json +++ b/extensions/theme-defaults/package.nls.json @@ -1,10 +1,10 @@ { "displayName": "Default Themes", "description": "The default Visual Studio light and dark themes", - "darkPlusColorThemeLabel": "Dark+ (default dark)", - "darkPlusExperimentalColorThemeLabel": "Dark+ V2 (Experimental)", - "lightPlusColorThemeLabel": "Light+ (default light)", - "lightPlusExperimentalColorThemeLabel": "Light+ V2 (Experimental)", + "darkPlusColorThemeLabel": "Dark+", + "darkPlusExperimentalColorThemeLabel": "Dark+ Experimental", + "lightPlusColorThemeLabel": "Light+", + "lightPlusExperimentalColorThemeLabel": "Light+ Experimental", "darkColorThemeLabel": "Dark (Visual Studio)", "lightColorThemeLabel": "Light (Visual Studio)", "hcColorThemeLabel": "Dark High Contrast", diff --git a/extensions/theme-defaults/themes/dark_plus.json b/extensions/theme-defaults/themes/dark_plus.json index fc2fd7d7f32..ed80b1785f6 100644 --- a/extensions/theme-defaults/themes/dark_plus.json +++ b/extensions/theme-defaults/themes/dark_plus.json @@ -1,6 +1,6 @@ { "$schema": "vscode://schemas/color-theme", - "name": "Dark+ (default dark)", + "name": "Dark+", "include": "./dark_vs.json", "tokenColors": [ { diff --git a/extensions/theme-defaults/themes/dark_plus_experimental.json b/extensions/theme-defaults/themes/dark_plus_experimental.json index 053d659313a..04236f7ed9d 100644 --- a/extensions/theme-defaults/themes/dark_plus_experimental.json +++ b/extensions/theme-defaults/themes/dark_plus_experimental.json @@ -134,6 +134,6 @@ "titleBar.inactiveForeground": "#8b949e", "welcomePage.tileBackground": "#ffffff0f", "welcomePage.progress.foreground": "#0078d4", - "widgetBorder": "#ffffff15", + "widget.border": "#ffffff15", }, } diff --git a/extensions/theme-defaults/themes/light_plus.json b/extensions/theme-defaults/themes/light_plus.json index d24599e6feb..f73b79579f0 100644 --- a/extensions/theme-defaults/themes/light_plus.json +++ b/extensions/theme-defaults/themes/light_plus.json @@ -1,6 +1,6 @@ { "$schema": "vscode://schemas/color-theme", - "name": "Light+ (default light)", + "name": "Light+", "include": "./light_vs.json", "tokenColors": [ // adds rules to the light vs rules { diff --git a/extensions/theme-defaults/themes/light_plus_experimental.json b/extensions/theme-defaults/themes/light_plus_experimental.json index c1c0729ff8e..73d42822fcc 100644 --- a/extensions/theme-defaults/themes/light_plus_experimental.json +++ b/extensions/theme-defaults/themes/light_plus_experimental.json @@ -147,6 +147,6 @@ "titleBar.inactiveBackground": "#f8f8f8", "titleBar.inactiveForeground": "#8b949e", "welcomePage.tileBackground": "#f3f3f3", - "widgetBorder": "#0000001a", + "widget.border": "#0000001a", }, } diff --git a/src/vs/workbench/contrib/themes/browser/themes.contribution.ts b/src/vs/workbench/contrib/themes/browser/themes.contribution.ts index c94be398bf3..45e86052a1b 100644 --- a/src/vs/workbench/contrib/themes/browser/themes.contribution.ts +++ b/src/vs/workbench/contrib/themes/browser/themes.contribution.ts @@ -9,7 +9,7 @@ import { MenuRegistry, MenuId, Action2, registerAction2, ISubmenuItem } from 'vs import { equalsIgnoreCase } from 'vs/base/common/strings'; import { Registry } from 'vs/platform/registry/common/platform'; import { Categories } from 'vs/platform/action/common/actionCommonCategories'; -import { IWorkbenchThemeService, IWorkbenchTheme, ThemeSettingTarget, IWorkbenchColorTheme, IWorkbenchFileIconTheme, IWorkbenchProductIconTheme, ThemeSettings } from 'vs/workbench/services/themes/common/workbenchThemeService'; +import { IWorkbenchThemeService, IWorkbenchTheme, ThemeSettingTarget, IWorkbenchColorTheme, IWorkbenchFileIconTheme, IWorkbenchProductIconTheme, ThemeSettings, ThemeSettingDefaults } from 'vs/workbench/services/themes/common/workbenchThemeService'; import { VIEWLET_ID, IExtensionsViewPaneContainer } from 'vs/workbench/contrib/extensions/common/extensions'; import { IExtensionGalleryService, IExtensionManagementService, IGalleryExtension } from 'vs/platform/extensionManagement/common/extensionManagement'; import { IColorRegistry, Extensions as ColorRegistryExtensions } from 'vs/platform/theme/common/colorRegistry'; @@ -33,10 +33,16 @@ import { Emitter } from 'vs/base/common/event'; import { IExtensionResourceLoaderService } from 'vs/platform/extensionResourceLoader/common/extensionResourceLoader'; import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; -import { CommandsRegistry } from 'vs/platform/commands/common/commands'; +import { CommandsRegistry, ICommandService } from 'vs/platform/commands/common/commands'; import { FileIconThemeData } from 'vs/workbench/services/themes/browser/fileIconThemeData'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IDialogService } from 'vs/platform/dialogs/common/dialogs'; +import { IWorkbenchContribution, IWorkbenchContributionsRegistry, Extensions } from 'vs/workbench/common/contributions'; +import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle'; +import { INotificationService, Severity } from 'vs/platform/notification/common/notification'; +import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage'; +import { toAction } from 'vs/base/common/actions'; +import { isWeb } from 'vs/base/common/platform'; export const manageExtensionIcon = registerIcon('theme-selection-manage-extension', Codicon.gear, localize('manageExtensionIcon', 'Icon for the \'Manage\' action in the theme selection quick pick.')); @@ -693,3 +699,49 @@ MenuRegistry.appendMenuItem(ThemesSubMenu, { order: 3 }); +class DefaultThemeUpdatedNotificationContribution implements IWorkbenchContribution { + + static STORAGE_KEY = 'themeUpdatedNotificationShown'; + + constructor( + @INotificationService private readonly _notificationService: INotificationService, + @IWorkbenchThemeService private readonly _workbenchThemeService: IWorkbenchThemeService, + @IStorageService private readonly _storageService: IStorageService, + @ICommandService private readonly _commandService: ICommandService, + ) { + if (!this._workbenchThemeService.hasUpdatedDefaultThemes()) { + return; + } + if (_storageService.getBoolean(DefaultThemeUpdatedNotificationContribution.STORAGE_KEY, StorageScope.APPLICATION)) { + return; + } + setTimeout(() => { + this._showNotification(); + }, 6000); + } + + private async _showNotification(): Promise { + this._storageService.store(DefaultThemeUpdatedNotificationContribution.STORAGE_KEY, true, StorageScope.APPLICATION, StorageTarget.USER); + await this._notificationService.notify({ + id: 'themeUpdatedNotification', + severity: Severity.Info, + message: localize({ key: 'themeUpdatedNotification', comment: ['{0} is the name of the new default theme'] }, "VS Code now ships with a new default theme '{0}'. We hope you like it. If not, you can switch back to the old theme or try one of the many other color themes available.", this._workbenchThemeService.getColorTheme().label), + actions: { + primary: [ + toAction({ id: 'themeUpdated.browseThemes', label: localize('browseThemes', "Browse Themes"), run: () => this._commandService.executeCommand(SelectColorThemeCommandId) }), + toAction({ + id: 'themeUpdated.revert', label: localize('revert', "Revert"), run: async () => { + const oldSettingsId = isWeb ? ThemeSettingDefaults.COLOR_THEME_LIGHT_OLD : ThemeSettingDefaults.COLOR_THEME_DARK_OLD; + const oldTheme = (await this._workbenchThemeService.getColorThemes()).find(theme => theme.settingsId === oldSettingsId); + if (oldTheme) { + this._workbenchThemeService.setColorTheme(oldTheme, 'auto'); + } + } + }) + ] + } + }); + } +} +const workbenchRegistry = Registry.as(Extensions.Workbench); +workbenchRegistry.registerWorkbenchContribution(DefaultThemeUpdatedNotificationContribution, LifecyclePhase.Ready); diff --git a/src/vs/workbench/contrib/welcomeGettingStarted/common/media/theme_picker.ts b/src/vs/workbench/contrib/welcomeGettingStarted/common/media/theme_picker.ts index 766134e5f6d..40a664e7581 100644 --- a/src/vs/workbench/contrib/welcomeGettingStarted/common/media/theme_picker.ts +++ b/src/vs/workbench/contrib/welcomeGettingStarted/common/media/theme_picker.ts @@ -5,25 +5,26 @@ import { escape } from 'vs/base/common/strings'; import { localize } from 'vs/nls'; +import { ThemeSettingDefaults } from 'vs/workbench/services/themes/common/workbenchThemeService'; export default () => `
- + ${escape(localize('dark', "Dark"))} - + ${escape(localize('light', "Light"))}
- + ${escape(localize('HighContrast', "Dark High Contrast"))} - + ${escape(localize('HighContrastLight', "Light High Contrast"))} diff --git a/src/vs/workbench/services/themes/browser/productIconThemeData.ts b/src/vs/workbench/services/themes/browser/productIconThemeData.ts index da1add76935..98de9b94fc8 100644 --- a/src/vs/workbench/services/themes/browser/productIconThemeData.ts +++ b/src/vs/workbench/services/themes/browser/productIconThemeData.ts @@ -8,10 +8,9 @@ import * as nls from 'vs/nls'; import * as Paths from 'vs/base/common/path'; import * as resources from 'vs/base/common/resources'; import * as Json from 'vs/base/common/json'; -import { ExtensionData, IThemeExtensionPoint, IWorkbenchProductIconTheme } from 'vs/workbench/services/themes/common/workbenchThemeService'; +import { ExtensionData, IThemeExtensionPoint, IWorkbenchProductIconTheme, ThemeSettingDefaults } from 'vs/workbench/services/themes/common/workbenchThemeService'; import { getParseErrorMessage } from 'vs/base/common/jsonErrorMessages'; import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage'; -import { DEFAULT_PRODUCT_ICON_THEME_SETTING_VALUE } from 'vs/workbench/services/themes/common/themeConfiguration'; import { fontIdRegex, fontWeightRegex, fontStyleRegex, fontFormatRegex } from 'vs/workbench/services/themes/common/productIconThemeSchema'; import { isObject, isString } from 'vs/base/common/types'; import { ILogService } from 'vs/platform/log/common/log'; @@ -98,7 +97,7 @@ export class ProductIconThemeData implements IWorkbenchProductIconTheme { static get defaultTheme(): ProductIconThemeData { let themeData = ProductIconThemeData._defaultProductIconTheme; if (!themeData) { - themeData = ProductIconThemeData._defaultProductIconTheme = new ProductIconThemeData(DEFAULT_PRODUCT_ICON_THEME_ID, nls.localize('defaultTheme', 'Default'), DEFAULT_PRODUCT_ICON_THEME_SETTING_VALUE); + themeData = ProductIconThemeData._defaultProductIconTheme = new ProductIconThemeData(DEFAULT_PRODUCT_ICON_THEME_ID, nls.localize('defaultTheme', 'Default'), ThemeSettingDefaults.PRODUCT_ICON_THEME); themeData.isLoaded = true; themeData.extensionData = undefined; themeData.watch = false; diff --git a/src/vs/workbench/services/themes/browser/workbenchThemeService.ts b/src/vs/workbench/services/themes/browser/workbenchThemeService.ts index 41b75f7daf4..0ae7e479016 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 } 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 } 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'; @@ -44,9 +44,6 @@ import { ILanguageService } from 'vs/editor/common/languages/language'; // implementation -const DEFAULT_COLOR_THEME_ID = 'vs-dark vscode-theme-defaults-themes-dark_plus-json'; -const DEFAULT_LIGHT_COLOR_THEME_ID = 'vs vscode-theme-defaults-themes-light_plus-json'; - const PERSISTED_OS_COLOR_SCHEME = 'osColorScheme'; const PERSISTED_OS_COLOR_SCHEME_SCOPE = StorageScope.APPLICATION; // the OS scheme depends on settings in the OS @@ -104,6 +101,8 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { private themeSettingIdBeforeSchemeSwitch: string | undefined; + private hasDefaultUpdated: boolean = false; + constructor( @IExtensionService extensionService: IExtensionService, @IStorageService private readonly storageService: IStorageService, @@ -145,6 +144,8 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { // 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()) { + 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. themeData = undefined; } @@ -206,7 +207,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { if (devThemes.length) { return this.setColorTheme(devThemes[0].id, ConfigurationTarget.MEMORY); } - const fallbackTheme = this.currentColorTheme.type === ColorScheme.LIGHT ? DEFAULT_LIGHT_COLOR_THEME_ID : DEFAULT_COLOR_THEME_ID; + const fallbackTheme = this.currentColorTheme.type === ColorScheme.LIGHT ? ThemeSettingDefaults.COLOR_THEME_LIGHT : ThemeSettingDefaults.COLOR_THEME_DARK; const theme = this.colorThemeRegistry.findThemeBySettingsId(this.settings.colorTheme, fallbackTheme); const preferredColorScheme = this.getPreferredColorScheme(); @@ -307,7 +308,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { updateColorThemeConfigurationSchemas(event.themes); if (await this.restoreColorTheme()) { // checks if theme from settings exists and is set // restore theme - if (this.currentColorTheme.id === DEFAULT_COLOR_THEME_ID && !types.isUndefined(prevColorId) && await this.colorThemeRegistry.findThemeById(prevColorId)) { + if (this.currentColorTheme.settingsId === ThemeSettingDefaults.COLOR_THEME_DARK && !types.isUndefined(prevColorId) && await this.colorThemeRegistry.findThemeById(prevColorId)) { await this.setColorTheme(prevColorId, 'auto'); prevColorId = undefined; } else if (event.added.some(t => t.settingsId === this.currentColorTheme.settingsId)) { @@ -316,7 +317,8 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { } else if (event.removed.some(t => t.settingsId === this.currentColorTheme.settingsId)) { // current theme is no longer available prevColorId = this.currentColorTheme.id; - await this.setColorTheme(DEFAULT_COLOR_THEME_ID, 'auto'); + const defaultTheme = this.colorThemeRegistry.findThemeBySettingsId(ThemeSettingDefaults.COLOR_THEME_DARK); + await this.setColorTheme(defaultTheme, 'auto'); } }); @@ -423,6 +425,10 @@ export class WorkbenchThemeService implements IWorkbenchThemeService { return null; } + public hasUpdatedDefaultThemes(): boolean { + return this.hasDefaultUpdated; + } + public getColorTheme(): IWorkbenchColorTheme { return this.currentColorTheme; } diff --git a/src/vs/workbench/services/themes/common/colorThemeData.ts b/src/vs/workbench/services/themes/common/colorThemeData.ts index c498d6c4da4..257a77e7051 100644 --- a/src/vs/workbench/services/themes/common/colorThemeData.ts +++ b/src/vs/workbench/services/themes/common/colorThemeData.ts @@ -587,6 +587,22 @@ 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/themeConfiguration.ts b/src/vs/workbench/services/themes/common/themeConfiguration.ts index 556201b09b3..5e54716254c 100644 --- a/src/vs/workbench/services/themes/common/themeConfiguration.ts +++ b/src/vs/workbench/services/themes/common/themeConfiguration.ts @@ -12,19 +12,10 @@ import { IJSONSchema } from 'vs/base/common/jsonSchema'; import { textmateColorsSchemaId, textmateColorGroupSchemaId } from 'vs/workbench/services/themes/common/colorThemeSchema'; import { workbenchColorsSchemaId } from 'vs/platform/theme/common/colorRegistry'; import { tokenStylingSchemaId } from 'vs/platform/theme/common/tokenClassificationRegistry'; -import { ThemeSettings, IWorkbenchColorTheme, IWorkbenchFileIconTheme, IColorCustomizations, ITokenColorCustomizations, IWorkbenchProductIconTheme, ISemanticTokenColorCustomizations, ThemeSettingTarget } from 'vs/workbench/services/themes/common/workbenchThemeService'; +import { ThemeSettings, IWorkbenchColorTheme, IWorkbenchFileIconTheme, IColorCustomizations, ITokenColorCustomizations, IWorkbenchProductIconTheme, ISemanticTokenColorCustomizations, ThemeSettingTarget, ThemeSettingDefaults } from 'vs/workbench/services/themes/common/workbenchThemeService'; import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration'; import { isWeb } from 'vs/base/common/platform'; -const DEFAULT_THEME_DARK_SETTING_VALUE = 'Default Dark+'; -const DEFAULT_THEME_LIGHT_SETTING_VALUE = 'Default Light+'; -const DEFAULT_THEME_HC_DARK_SETTING_VALUE = 'Default High Contrast'; -const DEFAULT_THEME_HC_LIGHT_SETTING_VALUE = 'Default High Contrast Light'; - -const DEFAULT_FILE_ICON_THEME_SETTING_VALUE = 'vs-seti'; - -export const DEFAULT_PRODUCT_ICON_THEME_SETTING_VALUE = 'Default'; - // Configuration: Themes const configurationRegistry = Registry.as(ConfigurationExtensions.Configuration); @@ -35,7 +26,7 @@ const colorThemeSettingEnumDescriptions: string[] = []; const colorThemeSettingSchema: IConfigurationPropertySchema = { type: 'string', description: nls.localize('colorTheme', "Specifies the color theme used in the workbench."), - default: isWeb ? DEFAULT_THEME_LIGHT_SETTING_VALUE : DEFAULT_THEME_DARK_SETTING_VALUE, + default: isWeb ? ThemeSettingDefaults.COLOR_THEME_LIGHT : ThemeSettingDefaults.COLOR_THEME_DARK, enum: colorThemeSettingEnum, enumDescriptions: colorThemeSettingEnumDescriptions, enumItemLabels: colorThemeSettingEnumItemLabels, @@ -44,7 +35,7 @@ const colorThemeSettingSchema: IConfigurationPropertySchema = { const preferredDarkThemeSettingSchema: IConfigurationPropertySchema = { type: 'string', // markdownDescription: nls.localize({ key: 'preferredDarkColorTheme', comment: ['`#{0}#` will become a link to an other setting. Do not remove backtick or #'] }, 'Specifies the preferred color theme for dark OS appearance when `#{0}#` is enabled.', ThemeSettings.DETECT_COLOR_SCHEME), - default: DEFAULT_THEME_DARK_SETTING_VALUE, + default: ThemeSettingDefaults.COLOR_THEME_DARK, enum: colorThemeSettingEnum, enumDescriptions: colorThemeSettingEnumDescriptions, enumItemLabels: colorThemeSettingEnumItemLabels, @@ -53,7 +44,7 @@ const preferredDarkThemeSettingSchema: IConfigurationPropertySchema = { const preferredLightThemeSettingSchema: IConfigurationPropertySchema = { type: 'string', markdownDescription: nls.localize({ key: 'preferredLightColorTheme', comment: ['`#{0}#` will become a link to an other setting. Do not remove backtick or #'] }, 'Specifies the preferred color theme for light OS appearance when `#{0}#` is enabled.', ThemeSettings.DETECT_COLOR_SCHEME), - default: DEFAULT_THEME_LIGHT_SETTING_VALUE, + default: ThemeSettingDefaults.COLOR_THEME_LIGHT, enum: colorThemeSettingEnum, enumDescriptions: colorThemeSettingEnumDescriptions, enumItemLabels: colorThemeSettingEnumItemLabels, @@ -62,7 +53,7 @@ const preferredLightThemeSettingSchema: IConfigurationPropertySchema = { const preferredHCDarkThemeSettingSchema: IConfigurationPropertySchema = { type: 'string', markdownDescription: nls.localize({ key: 'preferredHCDarkColorTheme', comment: ['`#{0}#` will become a link to an other setting. Do not remove backtick or #'] }, 'Specifies the preferred color theme used in high contrast dark mode when `#{0}#` is enabled.', ThemeSettings.DETECT_HC), - default: DEFAULT_THEME_HC_DARK_SETTING_VALUE, + default: ThemeSettingDefaults.COLOR_THEME_HC_DARK, enum: colorThemeSettingEnum, enumDescriptions: colorThemeSettingEnumDescriptions, enumItemLabels: colorThemeSettingEnumItemLabels, @@ -71,7 +62,7 @@ const preferredHCDarkThemeSettingSchema: IConfigurationPropertySchema = { const preferredHCLightThemeSettingSchema: IConfigurationPropertySchema = { type: 'string', markdownDescription: nls.localize({ key: 'preferredHCLightColorTheme', comment: ['`#{0}#` will become a link to an other setting. Do not remove backtick or #'] }, 'Specifies the preferred color theme used in high contrast light mode when `#{0}#` is enabled.', ThemeSettings.DETECT_HC), - default: DEFAULT_THEME_HC_LIGHT_SETTING_VALUE, + default: ThemeSettingDefaults.COLOR_THEME_HC_LIGHT, enum: colorThemeSettingEnum, enumDescriptions: colorThemeSettingEnumDescriptions, enumItemLabels: colorThemeSettingEnumItemLabels, @@ -95,7 +86,7 @@ const colorCustomizationsSchema: IConfigurationPropertySchema = { }; const fileIconThemeSettingSchema: IConfigurationPropertySchema = { type: ['string', 'null'], - default: DEFAULT_FILE_ICON_THEME_SETTING_VALUE, + default: ThemeSettingDefaults.FILE_ICON_THEME, description: nls.localize('iconTheme', "Specifies the file icon theme used in the workbench or 'null' to not show any file icons."), enum: [null], enumItemLabels: [nls.localize('noIconThemeLabel', 'None')], @@ -104,9 +95,9 @@ const fileIconThemeSettingSchema: IConfigurationPropertySchema = { }; const productIconThemeSettingSchema: IConfigurationPropertySchema = { type: ['string', 'null'], - default: DEFAULT_PRODUCT_ICON_THEME_SETTING_VALUE, + default: ThemeSettingDefaults.PRODUCT_ICON_THEME, description: nls.localize('productIconTheme', "Specifies the product icon theme used."), - enum: [DEFAULT_PRODUCT_ICON_THEME_SETTING_VALUE], + enum: [ThemeSettingDefaults.PRODUCT_ICON_THEME], enumItemLabels: [nls.localize('defaultProductIconThemeLabel', 'Default')], enumDescriptions: [nls.localize('defaultProductIconThemeDesc', 'Default')], errorMessage: nls.localize('productIconThemeError', "Product icon theme is unknown or not installed.") diff --git a/src/vs/workbench/services/themes/common/themeExtensionPoints.ts b/src/vs/workbench/services/themes/common/themeExtensionPoints.ts index 741e79f8f85..8862328cba9 100644 --- a/src/vs/workbench/services/themes/common/themeExtensionPoints.ts +++ b/src/vs/workbench/services/themes/common/themeExtensionPoints.ts @@ -197,24 +197,20 @@ export class ThemeRegistry { return resultingThemes; } - public findThemeById(themeId: string, defaultId?: string): T | undefined { + public findThemeById(themeId: string): T | undefined { if (this.builtInTheme && this.builtInTheme.id === themeId) { return this.builtInTheme; } const allThemes = this.getThemes(); - let defaultTheme: T | undefined = undefined; for (const t of allThemes) { if (t.id === themeId) { return t; } - if (t.id === defaultId) { - defaultTheme = t; - } } - return defaultTheme; + return undefined; } - public findThemeBySettingsId(settingsId: string | null, defaultId?: string): T | undefined { + public findThemeBySettingsId(settingsId: string | null, defaultSettingsId?: string): T | undefined { if (this.builtInTheme && this.builtInTheme.settingsId === settingsId) { return this.builtInTheme; } @@ -224,7 +220,7 @@ export class ThemeRegistry { if (t.settingsId === settingsId) { return t; } - if (t.id === defaultId) { + if (t.settingsId === defaultSettingsId) { defaultTheme = t; } } diff --git a/src/vs/workbench/services/themes/common/workbenchThemeService.ts b/src/vs/workbench/services/themes/common/workbenchThemeService.ts index dbcb760c1bc..149b290979f 100644 --- a/src/vs/workbench/services/themes/common/workbenchThemeService.ts +++ b/src/vs/workbench/services/themes/common/workbenchThemeService.ts @@ -40,6 +40,19 @@ export enum ThemeSettings { DETECT_HC = 'window.autoDetectHighContrast' } +export enum ThemeSettingDefaults { + COLOR_THEME_DARK = 'Default Dark+ Experimental', + COLOR_THEME_LIGHT = 'Default Light+ Experimental', + COLOR_THEME_HC_DARK = 'Default High Contrast', + COLOR_THEME_HC_LIGHT = 'Default High Contrast Light', + + COLOR_THEME_DARK_OLD = 'Default Dark+', + COLOR_THEME_LIGHT_OLD = 'Default Light+', + + FILE_ICON_THEME = 'vs-seti', + PRODUCT_ICON_THEME = 'Default' +} + export interface IWorkbenchTheme { readonly id: string; readonly label: string; @@ -77,6 +90,8 @@ export interface IWorkbenchThemeService extends IThemeService { getMarketplaceColorThemes(publisher: string, name: string, version: string): Promise; onDidColorThemeChange: Event; + hasUpdatedDefaultThemes(): boolean; + setFileIconTheme(iconThemeId: string | undefined | IWorkbenchFileIconTheme, settingsTarget: ThemeSettingTarget): Promise; getFileIconTheme(): IWorkbenchFileIconTheme; getFileIconThemes(): Promise;