提交 51f85b5c 编写于 作者: M Martin Aeschlimann

set default theme according to defaultThemeType

上级 2b9a1413
......@@ -102,7 +102,8 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
@ILogService private readonly logService: ILogService
) {
this.container = layoutService.container;
this.settings = new ThemeConfiguration(configurationService);
const defaultThemeType = environmentService.configuration.defaultThemeType || DARK;
this.settings = new ThemeConfiguration(configurationService, defaultThemeType);
this.colorThemeRegistry = new ThemeRegistry(extensionService, colorThemesExtPoint, ColorThemeData.fromExtensionTheme);
this.colorThemeWatcher = new ThemeFileWatcher(fileService, environmentService, this.reloadCurrentColorTheme.bind(this));
......@@ -127,7 +128,6 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
themeData = ColorThemeData.createUnloadedThemeForThemeType(HIGH_CONTRAST);
}
if (!themeData) {
const defaultThemeType = environmentService.configuration.defaultThemeType || DARK;
themeData = ColorThemeData.createUnloadedThemeForThemeType(defaultThemeType);
}
themeData.setCustomizations(this.settings);
......
......@@ -14,7 +14,8 @@ import { workbenchColorsSchemaId } from 'vs/platform/theme/common/colorRegistry'
import { tokenStylingSchemaId } from 'vs/platform/theme/common/tokenClassificationRegistry';
import { ThemeSettings, IWorkbenchColorTheme, IWorkbenchFileIconTheme, IColorCustomizations, ITokenColorCustomizations, IWorkbenchProductIconTheme, ISemanticTokenColorCustomizations, IExperimentalSemanticTokenColorCustomizations } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
const DEFAULT_THEME_SETTING_VALUE = 'Default Dark+';
import { ThemeType, HIGH_CONTRAST, LIGHT } from 'vs/platform/theme/common/themeService';
const DEFAULT_THEME_DARK_SETTING_VALUE = 'Default Dark+';
const DEFAULT_THEME_LIGHT_SETTING_VALUE = 'Default Light+';
const DEFAULT_THEME_HC_SETTING_VALUE = 'Default High Contrast';
......@@ -32,7 +33,7 @@ const colorThemeSettingEnumDescriptions: string[] = [];
const colorThemeSettingSchema: IConfigurationPropertySchema = {
type: 'string',
description: nls.localize('colorTheme', "Specifies the color theme used in the workbench."),
default: DEFAULT_THEME_SETTING_VALUE,
default: DEFAULT_THEME_DARK_SETTING_VALUE,
enum: colorThemeSettingEnum,
enumDescriptions: colorThemeSettingEnumDescriptions,
errorMessage: nls.localize('colorThemeError', "Theme is unknown or not installed."),
......@@ -109,7 +110,6 @@ const themeSettingsConfiguration: IConfigurationNode = {
[ThemeSettings.PRODUCT_ICON_THEME]: productIconThemeSettingSchema
}
};
configurationRegistry.registerConfiguration(themeSettingsConfiguration);
function tokenGroupSettings(description: string): IJSONSchema {
return {
......@@ -231,7 +231,19 @@ export function updateProductIconThemeConfigurationSchemas(themes: IWorkbenchPro
export class ThemeConfiguration {
constructor(private configurationService: IConfigurationService) {
constructor(private configurationService: IConfigurationService, themeType: ThemeType) {
switch (themeType) {
case LIGHT:
colorThemeSettingSchema.default = DEFAULT_THEME_LIGHT_SETTING_VALUE;
break;
case HIGH_CONTRAST:
colorThemeSettingSchema.default = DEFAULT_THEME_HC_SETTING_VALUE;
break;
default:
colorThemeSettingSchema.default = DEFAULT_THEME_DARK_SETTING_VALUE;
break;
}
configurationRegistry.registerConfiguration(themeSettingsConfiguration);
}
public get colorTheme(): string {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册