preferredHighContrastLightTheme setting and more changes
parent
9245f60f40
commit
1c4ffb26d9
|
@ -44,7 +44,7 @@
|
|||
"path": "./themes/hc_black.json"
|
||||
},
|
||||
{
|
||||
"id": "Light High Contrast",
|
||||
"id": "Default High Contrast Light",
|
||||
"label": "%lightHcColorThemeLabel%",
|
||||
"uiTheme": "hc-light",
|
||||
"path": "./themes/hc_light.json"
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
{
|
||||
"$schema": "vscode://schemas/color-theme",
|
||||
"name": "Light High Contrast",
|
||||
"type": "hc",
|
||||
"colors": {
|
||||
"contrastActiveBorder": "#0F4A85",
|
||||
"contrastBorder": "#0F4A85",
|
||||
|
|
|
@ -14,7 +14,7 @@ import { IExtensionGalleryService, IExtensionManagementService, IGalleryExtensio
|
|||
import { IColorRegistry, Extensions as ColorRegistryExtensions } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { Color } from 'vs/base/common/color';
|
||||
import { ColorScheme } from 'vs/platform/theme/common/theme';
|
||||
import { ColorScheme, isHighContrast } from 'vs/platform/theme/common/theme';
|
||||
import { colorThemeSchemaId } from 'vs/workbench/services/themes/common/colorThemeSchema';
|
||||
import { isCancellationError, onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { IQuickInputButton, IQuickInputService, IQuickPickItem, QuickPickInput } from 'vs/platform/quickinput/common/quickInput';
|
||||
|
@ -376,9 +376,7 @@ registerAction2(class extends Action2 {
|
|||
const picks: QuickPickInput<ThemeItem>[] = [
|
||||
...toEntries(themes.filter(t => t.type === ColorScheme.LIGHT), localize('themes.category.light', "light themes")),
|
||||
...toEntries(themes.filter(t => t.type === ColorScheme.DARK), localize('themes.category.dark', "dark themes")),
|
||||
...toEntries(themes.filter(t => t.type === ColorScheme.HIGH_CONTRAST_LIGHT), localize('themes.category.hclight', "light high contrast themes")),
|
||||
...toEntries(themes.filter(t => t.type === ColorScheme.HIGH_CONTRAST_DARK), localize('themes.category.hcdark', "dark high contrast themes")),
|
||||
|
||||
...toEntries(themes.filter(t => isHighContrast(t.type)), localize('themes.category.hc', "high contrast themes")),
|
||||
];
|
||||
await picker.openQuickPick(picks, currentTheme);
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ export const walkthroughsExtensionPoint = ExtensionsRegistry.registerExtensionPo
|
|||
},
|
||||
{
|
||||
type: 'object',
|
||||
required: ['dark', 'light', 'hc'],
|
||||
required: ['dark', 'light', 'hc', 'hcLight'],
|
||||
properties: {
|
||||
dark: {
|
||||
description: localize('walkthroughs.steps.media.image.path.dark.string', "Path to the image for dark themes, relative to extension directory."),
|
||||
|
@ -103,6 +103,10 @@ export const walkthroughsExtensionPoint = ExtensionsRegistry.registerExtensionPo
|
|||
hc: {
|
||||
description: localize('walkthroughs.steps.media.image.path.hc.string', "Path to the image for hc themes, relative to extension directory."),
|
||||
type: 'string',
|
||||
},
|
||||
hcLight: {
|
||||
description: localize('walkthroughs.steps.media.image.path.hcLight.string', "Path to the image for hc light themes, relative to extension directory."),
|
||||
type: 'string',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,10 @@ export default () => `
|
|||
<img width="150" src="./monokai.png"/>
|
||||
${escape(localize('HighContrast', "High Contrast"))}
|
||||
</checkbox>
|
||||
<checkbox when-checked="setTheme:Default High Contrast Light" checked-on="config.workbench.colorTheme == 'Default High Contrast Light'">
|
||||
<img width="150" src="./monokai.png"/>
|
||||
${escape(localize('HighContrast Light', "High Contrast Light"))}
|
||||
</checkbox>
|
||||
</checklist>
|
||||
<checkbox when-checked="command:workbench.action.selectTheme" checked-on="false">
|
||||
${escape(localize('seeMore', "See More Themes..."))}
|
||||
|
|
|
@ -243,21 +243,32 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
|
|||
|
||||
private installConfigurationListener() {
|
||||
this.configurationService.onDidChangeConfiguration(e => {
|
||||
let lazyPreferredColorScheme: ColorScheme | undefined | null = null;
|
||||
const getPreferredColorScheme = () => {
|
||||
if (lazyPreferredColorScheme === null) {
|
||||
lazyPreferredColorScheme = this.getPreferredColorScheme();
|
||||
}
|
||||
return lazyPreferredColorScheme;
|
||||
};
|
||||
|
||||
if (e.affectsConfiguration(ThemeSettings.COLOR_THEME)) {
|
||||
this.restoreColorTheme();
|
||||
}
|
||||
if (e.affectsConfiguration(ThemeSettings.DETECT_COLOR_SCHEME) || e.affectsConfiguration(ThemeSettings.DETECT_HC)) {
|
||||
this.handlePreferredSchemeUpdated();
|
||||
}
|
||||
if (e.affectsConfiguration(ThemeSettings.PREFERRED_DARK_THEME) && this.getPreferredColorScheme() === ColorScheme.DARK) {
|
||||
if (e.affectsConfiguration(ThemeSettings.PREFERRED_DARK_THEME) && getPreferredColorScheme() === ColorScheme.DARK) {
|
||||
this.applyPreferredColorTheme(ColorScheme.DARK);
|
||||
}
|
||||
if (e.affectsConfiguration(ThemeSettings.PREFERRED_LIGHT_THEME) && this.getPreferredColorScheme() === ColorScheme.LIGHT) {
|
||||
if (e.affectsConfiguration(ThemeSettings.PREFERRED_LIGHT_THEME) && getPreferredColorScheme() === ColorScheme.LIGHT) {
|
||||
this.applyPreferredColorTheme(ColorScheme.LIGHT);
|
||||
}
|
||||
if (e.affectsConfiguration(ThemeSettings.PREFERRED_HC_THEME) && this.getPreferredColorScheme() === ColorScheme.HIGH_CONTRAST_DARK) {
|
||||
if (e.affectsConfiguration(ThemeSettings.PREFERRED_HC_DARK_THEME) && getPreferredColorScheme() === ColorScheme.HIGH_CONTRAST_DARK) {
|
||||
this.applyPreferredColorTheme(ColorScheme.HIGH_CONTRAST_DARK);
|
||||
}
|
||||
if (e.affectsConfiguration(ThemeSettings.PREFERRED_HC_LIGHT_THEME) && getPreferredColorScheme() === ColorScheme.HIGH_CONTRAST_LIGHT) {
|
||||
this.applyPreferredColorTheme(ColorScheme.HIGH_CONTRAST_LIGHT);
|
||||
}
|
||||
if (e.affectsConfiguration(ThemeSettings.FILE_ICON_THEME)) {
|
||||
this.restoreFileIconTheme();
|
||||
}
|
||||
|
@ -392,7 +403,14 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
|
|||
}
|
||||
|
||||
private async applyPreferredColorTheme(type: ColorScheme): Promise<IWorkbenchColorTheme | null> {
|
||||
const settingId = type === ColorScheme.DARK ? ThemeSettings.PREFERRED_DARK_THEME : type === ColorScheme.LIGHT ? ThemeSettings.PREFERRED_LIGHT_THEME : ThemeSettings.PREFERRED_HC_THEME;
|
||||
let settingId: ThemeSettings;
|
||||
switch (type) {
|
||||
case ColorScheme.LIGHT: settingId = ThemeSettings.PREFERRED_LIGHT_THEME; break;
|
||||
case ColorScheme.HIGH_CONTRAST_DARK: settingId = ThemeSettings.PREFERRED_HC_DARK_THEME; break;
|
||||
case ColorScheme.HIGH_CONTRAST_LIGHT: settingId = ThemeSettings.PREFERRED_HC_LIGHT_THEME; break;
|
||||
default:
|
||||
settingId = ThemeSettings.PREFERRED_DARK_THEME;
|
||||
}
|
||||
const themeSettingId = this.configurationService.getValue(settingId);
|
||||
if (themeSettingId && typeof themeSettingId === 'string') {
|
||||
const theme = this.colorThemeRegistry.findThemeBySettingsId(themeSettingId, undefined);
|
||||
|
|
|
@ -781,12 +781,18 @@ let defaultThemeColors: { [baseTheme: string]: ITextMateThemingRule[] } = {
|
|||
{ scope: 'token.error-token', settings: { foreground: '#f44747' } },
|
||||
{ scope: 'token.debug-token', settings: { foreground: '#b267e6' } }
|
||||
],
|
||||
'hc': [
|
||||
'hcLight': [
|
||||
{ scope: 'token.info-token', settings: { foreground: '#316bcd' } },
|
||||
{ scope: 'token.warn-token', settings: { foreground: '#cd9731' } },
|
||||
{ scope: 'token.error-token', settings: { foreground: '#cd3131' } },
|
||||
{ scope: 'token.debug-token', settings: { foreground: '#800080' } }
|
||||
],
|
||||
'hcDark': [
|
||||
{ scope: 'token.info-token', settings: { foreground: '#6796e6' } },
|
||||
{ scope: 'token.warn-token', settings: { foreground: '#008000' } },
|
||||
{ scope: 'token.error-token', settings: { foreground: '#FF0000' } },
|
||||
{ scope: 'token.debug-token', settings: { foreground: '#b267e6' } }
|
||||
],
|
||||
]
|
||||
};
|
||||
|
||||
const noMatch = (_scope: ProbeScope) => -1;
|
||||
|
|
|
@ -18,7 +18,8 @@ import { isMacintosh, isWeb, isWindows } 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_SETTING_VALUE = 'Default High Contrast';
|
||||
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';
|
||||
|
||||
|
@ -58,10 +59,20 @@ const preferredLightThemeSettingSchema: IConfigurationPropertySchema = {
|
|||
enumItemLabels: colorThemeSettingEnumItemLabels,
|
||||
errorMessage: nls.localize('colorThemeError', "Theme is unknown or not installed."),
|
||||
};
|
||||
const preferredHCThemeSettingSchema: IConfigurationPropertySchema = {
|
||||
const preferredHCDarkThemeSettingSchema: IConfigurationPropertySchema = {
|
||||
type: 'string',
|
||||
markdownDescription: nls.localize({ key: 'preferredHCColorTheme', comment: ['`#{0}#` will become a link to an other setting. Do not remove backtick or #'] }, 'Specifies the preferred color theme used in high contrast mode when `#{0}#` is enabled.', ThemeSettings.DETECT_HC),
|
||||
default: DEFAULT_THEME_HC_SETTING_VALUE,
|
||||
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,
|
||||
enum: colorThemeSettingEnum,
|
||||
enumDescriptions: colorThemeSettingEnumDescriptions,
|
||||
enumItemLabels: colorThemeSettingEnumItemLabels,
|
||||
included: isWindows || isMacintosh,
|
||||
errorMessage: nls.localize('colorThemeError', "Theme is unknown or not installed."),
|
||||
};
|
||||
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,
|
||||
enum: colorThemeSettingEnum,
|
||||
enumDescriptions: colorThemeSettingEnumDescriptions,
|
||||
enumItemLabels: colorThemeSettingEnumItemLabels,
|
||||
|
@ -106,7 +117,7 @@ const productIconThemeSettingSchema: IConfigurationPropertySchema = {
|
|||
const detectHCSchemeSettingSchema: IConfigurationPropertySchema = {
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
markdownDescription: nls.localize('autoDetectHighContrast', "If enabled, will automatically change to high contrast theme if the OS is using a high contrast theme. The high contrast theme to use is specified by `#{0}#`", ThemeSettings.PREFERRED_HC_THEME),
|
||||
markdownDescription: nls.localize('autoDetectHighContrast', "If enabled, will automatically change to high contrast theme if the OS is using a high contrast theme. The high contrast theme to use is specified by `#{0}#` and `#{1}#`", ThemeSettings.PREFERRED_HC_DARK_THEME, ThemeSettings.PREFERRED_HC_LIGHT_THEME),
|
||||
scope: ConfigurationScope.APPLICATION
|
||||
};
|
||||
|
||||
|
@ -118,7 +129,8 @@ const themeSettingsConfiguration: IConfigurationNode = {
|
|||
[ThemeSettings.COLOR_THEME]: colorThemeSettingSchema,
|
||||
[ThemeSettings.PREFERRED_DARK_THEME]: preferredDarkThemeSettingSchema,
|
||||
[ThemeSettings.PREFERRED_LIGHT_THEME]: preferredLightThemeSettingSchema,
|
||||
[ThemeSettings.PREFERRED_HC_THEME]: preferredHCThemeSettingSchema,
|
||||
[ThemeSettings.PREFERRED_HC_DARK_THEME]: preferredHCDarkThemeSettingSchema,
|
||||
[ThemeSettings.PREFERRED_HC_LIGHT_THEME]: preferredHCLightThemeSettingSchema,
|
||||
[ThemeSettings.FILE_ICON_THEME]: fileIconThemeSettingSchema,
|
||||
[ThemeSettings.COLOR_CUSTOMIZATIONS]: colorCustomizationsSchema,
|
||||
[ThemeSettings.PRODUCT_ICON_THEME]: productIconThemeSettingSchema
|
||||
|
|
|
@ -18,8 +18,6 @@ export const VS_DARK_THEME = 'vs-dark';
|
|||
export const VS_HC_THEME = 'hc-black';
|
||||
export const VS_HC_LIGHT_THEME = 'hc-light';
|
||||
|
||||
export const HC_THEME_ID = 'Default High Contrast';
|
||||
|
||||
export const THEME_SCOPE_OPEN_PAREN = '[';
|
||||
export const THEME_SCOPE_CLOSE_PAREN = ']';
|
||||
export const THEME_SCOPE_WILDCARD = '*';
|
||||
|
@ -36,7 +34,8 @@ export enum ThemeSettings {
|
|||
|
||||
PREFERRED_DARK_THEME = 'workbench.preferredDarkColorTheme',
|
||||
PREFERRED_LIGHT_THEME = 'workbench.preferredLightColorTheme',
|
||||
PREFERRED_HC_THEME = 'workbench.preferredHighContrastColorTheme',
|
||||
PREFERRED_HC_DARK_THEME = 'workbench.preferredHighContrastColorTheme', /* id kept for compatibility reasons */
|
||||
PREFERRED_HC_LIGHT_THEME = 'workbench.preferredHighContrastLightColorTheme',
|
||||
DETECT_COLOR_SCHEME = 'window.autoDetectColorScheme',
|
||||
DETECT_HC = 'window.autoDetectHighContrast'
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue