@codingame/monaco-vscode-theme-service-override 26.2.2 → 27.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/vscode/src/vs/workbench/contrib/themes/browser/themes.contribution.js +41 -41
- package/vscode/src/vs/workbench/services/themes/browser/colorThemeCss.d.ts +19 -0
- package/vscode/src/vs/workbench/services/themes/browser/colorThemeCss.js +53 -0
- package/vscode/src/vs/workbench/services/themes/browser/fileIconThemeData.js +2 -2
- package/vscode/src/vs/workbench/services/themes/browser/productIconThemeData.js +12 -12
- package/vscode/src/vs/workbench/services/themes/browser/workbenchThemeService.js +14 -36
- package/vscode/src/vs/workbench/services/themes/common/colorThemeSchema.js +16 -16
- package/vscode/src/vs/workbench/services/themes/common/fileIconThemeSchema.js +38 -38
- package/vscode/src/vs/workbench/services/themes/common/productIconThemeSchema.js +7 -7
- package/vscode/src/vs/workbench/services/themes/common/themeConfiguration.js +36 -36
- package/vscode/src/vs/workbench/services/themes/common/themeExtensionPoints.js +22 -21
- package/vscode/src/vs/platform/theme/common/sizeUtils.d.ts +0 -90
- package/vscode/src/vs/platform/theme/common/sizeUtils.js +0 -142
- package/vscode/src/vs/platform/theme/common/sizes/baseSizes.d.ts +0 -11
- package/vscode/src/vs/platform/theme/common/sizes/baseSizes.js +0 -18
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-theme-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "27.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "VSCode public API plugged on the monaco editor - theme service-override",
|
|
6
6
|
"keywords": [],
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
},
|
|
16
16
|
"type": "module",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@codingame/monaco-vscode-api": "
|
|
19
|
-
"@codingame/monaco-vscode-files-service-override": "
|
|
18
|
+
"@codingame/monaco-vscode-api": "27.0.0",
|
|
19
|
+
"@codingame/monaco-vscode-files-service-override": "27.0.0"
|
|
20
20
|
},
|
|
21
21
|
"main": "index.js",
|
|
22
22
|
"module": "index.js",
|
|
@@ -52,7 +52,7 @@ import { IPreferencesService } from '@codingame/monaco-vscode-api/vscode/vs/work
|
|
|
52
52
|
import { DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
53
53
|
import Severity from '@codingame/monaco-vscode-api/vscode/vs/base/common/severity';
|
|
54
54
|
|
|
55
|
-
const manageExtensionIcon = registerIcon("theme-selection-manage-extension", Codicon.gear, ( localize(
|
|
55
|
+
const manageExtensionIcon = registerIcon("theme-selection-manage-extension", Codicon.gear, ( localize(14172, "Icon for the 'Manage' action in the theme selection quick pick.")));
|
|
56
56
|
var ConfigureItem;
|
|
57
57
|
(function(ConfigureItem) {
|
|
58
58
|
ConfigureItem["BROWSE_GALLERY"] = "marketplace";
|
|
@@ -178,7 +178,7 @@ let MarketplaceThemesPicker = class MarketplaceThemesPicker {
|
|
|
178
178
|
quickpick.matchOnDescription = true;
|
|
179
179
|
quickpick.buttons = [this.quickInputService.backButton];
|
|
180
180
|
quickpick.title = "Marketplace Themes";
|
|
181
|
-
quickpick.placeholder = ( localize(
|
|
181
|
+
quickpick.placeholder = ( localize(14173, "Type to Search More. Select to Install. Up/Down Keys to Preview"));
|
|
182
182
|
quickpick.canSelectMany = false;
|
|
183
183
|
disposables.add(quickpick.onDidChangeValue(() => this.trigger(quickpick.value)));
|
|
184
184
|
disposables.add(quickpick.onDidAccept(async _ => {
|
|
@@ -232,7 +232,7 @@ let MarketplaceThemesPicker = class MarketplaceThemesPicker {
|
|
|
232
232
|
});
|
|
233
233
|
} else if (items.length === 0 && this._searchError) {
|
|
234
234
|
items = [{
|
|
235
|
-
label: `$(error) ${( localize(
|
|
235
|
+
label: `$(error) ${( localize(14174, "Error while searching for themes: {0}", this._searchError))}`,
|
|
236
236
|
id: undefined,
|
|
237
237
|
alwaysShow: true
|
|
238
238
|
}];
|
|
@@ -254,12 +254,12 @@ let MarketplaceThemesPicker = class MarketplaceThemesPicker {
|
|
|
254
254
|
this.extensionsWorkbenchService.openSearch(`@id:${galleryExtension.identifier.id}`);
|
|
255
255
|
const result = await this.dialogService.confirm({
|
|
256
256
|
message: ( localize(
|
|
257
|
-
|
|
257
|
+
14175,
|
|
258
258
|
"This will install extension '{0}' published by '{1}'. Do you want to continue?",
|
|
259
259
|
galleryExtension.displayName,
|
|
260
260
|
galleryExtension.publisherDisplayName
|
|
261
261
|
)),
|
|
262
|
-
primaryButton: ( localize(
|
|
262
|
+
primaryButton: ( localize(14176, "OK"))
|
|
263
263
|
});
|
|
264
264
|
if (!result.confirmed) {
|
|
265
265
|
return false;
|
|
@@ -267,7 +267,7 @@ let MarketplaceThemesPicker = class MarketplaceThemesPicker {
|
|
|
267
267
|
try {
|
|
268
268
|
await this.progressService.withProgress({
|
|
269
269
|
location: ProgressLocation.Notification,
|
|
270
|
-
title: ( localize(
|
|
270
|
+
title: ( localize(14177, "Installing Extension {0}...", galleryExtension.displayName))
|
|
271
271
|
}, async () => {
|
|
272
272
|
await this.extensionManagementService.installFromGallery(galleryExtension, {
|
|
273
273
|
isMachineScoped: false
|
|
@@ -418,7 +418,7 @@ registerAction2(class extends Action2 {
|
|
|
418
418
|
constructor() {
|
|
419
419
|
super({
|
|
420
420
|
id: SelectColorThemeCommandId,
|
|
421
|
-
title: ( localize2(
|
|
421
|
+
title: ( localize2(14178, "Color Theme")),
|
|
422
422
|
category: Categories.Preferences,
|
|
423
423
|
f1: true,
|
|
424
424
|
keybinding: {
|
|
@@ -430,15 +430,15 @@ registerAction2(class extends Action2 {
|
|
|
430
430
|
getTitle(colorScheme) {
|
|
431
431
|
switch (colorScheme) {
|
|
432
432
|
case ColorScheme.DARK:
|
|
433
|
-
return localize(
|
|
433
|
+
return localize(14179, "Select Color Theme for System Dark Mode");
|
|
434
434
|
case ColorScheme.LIGHT:
|
|
435
|
-
return localize(
|
|
435
|
+
return localize(14180, "Select Color Theme for System Light Mode");
|
|
436
436
|
case ColorScheme.HIGH_CONTRAST_DARK:
|
|
437
|
-
return localize(
|
|
437
|
+
return localize(14181, "Select Color Theme for High Contrast Dark Mode");
|
|
438
438
|
case ColorScheme.HIGH_CONTRAST_LIGHT:
|
|
439
|
-
return localize(
|
|
439
|
+
return localize(14182, "Select Color Theme for High Contrast Light Mode");
|
|
440
440
|
default:
|
|
441
|
-
return localize(
|
|
441
|
+
return localize(14183, "Select Color Theme (detect system color mode disabled)");
|
|
442
442
|
}
|
|
443
443
|
}
|
|
444
444
|
async run(accessor) {
|
|
@@ -446,13 +446,13 @@ registerAction2(class extends Action2 {
|
|
|
446
446
|
const preferencesService = accessor.get(IPreferencesService);
|
|
447
447
|
const preferredColorScheme = themeService.getPreferredColorScheme();
|
|
448
448
|
const modeConfigureButton = {
|
|
449
|
-
tooltip: preferredColorScheme ? ( localize(
|
|
449
|
+
tooltip: preferredColorScheme ? ( localize(14184, "Detect system color mode enabled. Click to configure.")) : ( localize(14185, "Detect system color mode disabled. Click to configure.")),
|
|
450
450
|
iconClass: ThemeIcon.asClassName(Codicon.colorMode),
|
|
451
451
|
location: QuickInputButtonLocation.Inline
|
|
452
452
|
};
|
|
453
453
|
const options = {
|
|
454
|
-
installMessage: ( localize(
|
|
455
|
-
browseMessage: "$(plus) " + ( localize(
|
|
454
|
+
installMessage: ( localize(14186, "Install Additional Color Themes...")),
|
|
455
|
+
browseMessage: "$(plus) " + ( localize(14187, "Browse Additional Color Themes...")),
|
|
456
456
|
placeholderMessage: this.getTitle(preferredColorScheme),
|
|
457
457
|
marketplaceTag: "category:themes",
|
|
458
458
|
buttons: [modeConfigureButton],
|
|
@@ -469,9 +469,9 @@ registerAction2(class extends Action2 {
|
|
|
469
469
|
const picker = instantiationService.createInstance(InstalledThemesPicker, options, setTheme, getMarketplaceColorThemes);
|
|
470
470
|
const themes = await themeService.getColorThemes();
|
|
471
471
|
const currentTheme = themeService.getColorTheme();
|
|
472
|
-
const lightEntries = toEntries(themes.filter(t => t.type === ColorScheme.LIGHT), ( localize(
|
|
473
|
-
const darkEntries = toEntries(themes.filter(t => t.type === ColorScheme.DARK), ( localize(
|
|
474
|
-
const hcEntries = toEntries(themes.filter(t => isHighContrast(t.type)), ( localize(
|
|
472
|
+
const lightEntries = toEntries(themes.filter(t => t.type === ColorScheme.LIGHT), ( localize(14188, "light themes")));
|
|
473
|
+
const darkEntries = toEntries(themes.filter(t => t.type === ColorScheme.DARK), ( localize(14189, "dark themes")));
|
|
474
|
+
const hcEntries = toEntries(themes.filter(t => isHighContrast(t.type)), ( localize(14190, "high contrast themes")));
|
|
475
475
|
let picks;
|
|
476
476
|
switch (preferredColorScheme) {
|
|
477
477
|
case ColorScheme.DARK:
|
|
@@ -494,7 +494,7 @@ registerAction2(class extends Action2 {
|
|
|
494
494
|
constructor() {
|
|
495
495
|
super({
|
|
496
496
|
id: SelectFileIconThemeCommandId,
|
|
497
|
-
title: ( localize2(
|
|
497
|
+
title: ( localize2(14191, "File Icon Theme")),
|
|
498
498
|
category: Categories.Preferences,
|
|
499
499
|
f1: true
|
|
500
500
|
});
|
|
@@ -502,8 +502,8 @@ registerAction2(class extends Action2 {
|
|
|
502
502
|
async run(accessor) {
|
|
503
503
|
const themeService = accessor.get(IWorkbenchThemeService);
|
|
504
504
|
const options = {
|
|
505
|
-
installMessage: ( localize(
|
|
506
|
-
placeholderMessage: ( localize(
|
|
505
|
+
installMessage: ( localize(14192, "Install Additional File Icon Themes...")),
|
|
506
|
+
placeholderMessage: ( localize(14193, "Select File Icon Theme (Up/Down Keys to Preview)")),
|
|
507
507
|
marketplaceTag: "tag:icon-theme"
|
|
508
508
|
};
|
|
509
509
|
const setTheme = (theme, settingsTarget) => themeService.setFileIconTheme(theme, settingsTarget);
|
|
@@ -512,12 +512,12 @@ registerAction2(class extends Action2 {
|
|
|
512
512
|
const picker = instantiationService.createInstance(InstalledThemesPicker, options, setTheme, getMarketplaceColorThemes);
|
|
513
513
|
const picks = [{
|
|
514
514
|
type: "separator",
|
|
515
|
-
label: ( localize(
|
|
515
|
+
label: ( localize(14194, "file icon themes"))
|
|
516
516
|
}, {
|
|
517
517
|
id: "",
|
|
518
518
|
theme: FileIconThemeData.noIconTheme,
|
|
519
|
-
label: ( localize(
|
|
520
|
-
description: ( localize(
|
|
519
|
+
label: ( localize(14195, "None")),
|
|
520
|
+
description: ( localize(14196, "Disable File Icons"))
|
|
521
521
|
}, ...toEntries(await themeService.getFileIconThemes())];
|
|
522
522
|
await picker.openQuickPick(picks, themeService.getFileIconTheme());
|
|
523
523
|
}
|
|
@@ -527,7 +527,7 @@ registerAction2(class extends Action2 {
|
|
|
527
527
|
constructor() {
|
|
528
528
|
super({
|
|
529
529
|
id: SelectProductIconThemeCommandId,
|
|
530
|
-
title: ( localize2(
|
|
530
|
+
title: ( localize2(14197, "Product Icon Theme")),
|
|
531
531
|
category: Categories.Preferences,
|
|
532
532
|
f1: true
|
|
533
533
|
});
|
|
@@ -535,9 +535,9 @@ registerAction2(class extends Action2 {
|
|
|
535
535
|
async run(accessor) {
|
|
536
536
|
const themeService = accessor.get(IWorkbenchThemeService);
|
|
537
537
|
const options = {
|
|
538
|
-
installMessage: ( localize(
|
|
539
|
-
browseMessage: "$(plus) " + ( localize(
|
|
540
|
-
placeholderMessage: ( localize(
|
|
538
|
+
installMessage: ( localize(14198, "Install Additional Product Icon Themes...")),
|
|
539
|
+
browseMessage: "$(plus) " + ( localize(14199, "Browse Additional Product Icon Themes...")),
|
|
540
|
+
placeholderMessage: ( localize(14200, "Select Product Icon Theme (Up/Down Keys to Preview)")),
|
|
541
541
|
marketplaceTag: "tag:product-icon-theme"
|
|
542
542
|
};
|
|
543
543
|
const setTheme = (theme, settingsTarget) => themeService.setProductIconTheme(theme, settingsTarget);
|
|
@@ -546,11 +546,11 @@ registerAction2(class extends Action2 {
|
|
|
546
546
|
const picker = instantiationService.createInstance(InstalledThemesPicker, options, setTheme, getMarketplaceColorThemes);
|
|
547
547
|
const picks = [{
|
|
548
548
|
type: "separator",
|
|
549
|
-
label: ( localize(
|
|
549
|
+
label: ( localize(14201, "product icon themes"))
|
|
550
550
|
}, {
|
|
551
551
|
id: DEFAULT_PRODUCT_ICON_THEME_ID,
|
|
552
552
|
theme: ProductIconThemeData.defaultTheme,
|
|
553
|
-
label: ( localize(
|
|
553
|
+
label: ( localize(14202, "Default"))
|
|
554
554
|
}, ...toEntries(await themeService.getProductIconThemes())];
|
|
555
555
|
await picker.openQuickPick(picks, themeService.getProductIconTheme());
|
|
556
556
|
}
|
|
@@ -617,13 +617,13 @@ function toEntries(themes, label) {
|
|
|
617
617
|
}
|
|
618
618
|
const configureButton = {
|
|
619
619
|
iconClass: ThemeIcon.asClassName(manageExtensionIcon),
|
|
620
|
-
tooltip: ( localize(
|
|
620
|
+
tooltip: ( localize(14203, "Manage Extension"))
|
|
621
621
|
};
|
|
622
622
|
registerAction2(class extends Action2 {
|
|
623
623
|
constructor() {
|
|
624
624
|
super({
|
|
625
625
|
id: "workbench.action.generateColorTheme",
|
|
626
|
-
title: ( localize2(
|
|
626
|
+
title: ( localize2(14204, "Generate Color Theme From Current Settings")),
|
|
627
627
|
category: Categories.Developer,
|
|
628
628
|
f1: true
|
|
629
629
|
});
|
|
@@ -678,7 +678,7 @@ registerAction2(class extends Action2 {
|
|
|
678
678
|
constructor() {
|
|
679
679
|
super({
|
|
680
680
|
id: toggleLightDarkThemesCommandId,
|
|
681
|
-
title: ( localize2(
|
|
681
|
+
title: ( localize2(14205, "Toggle between Light/Dark Themes")),
|
|
682
682
|
category: Categories.Preferences,
|
|
683
683
|
f1: true
|
|
684
684
|
});
|
|
@@ -690,12 +690,12 @@ registerAction2(class extends Action2 {
|
|
|
690
690
|
const preferencesService = accessor.get(IPreferencesService);
|
|
691
691
|
if (configurationService.getValue(ThemeSettings.DETECT_COLOR_SCHEME)) {
|
|
692
692
|
const message = ( localize(
|
|
693
|
-
|
|
693
|
+
14206,
|
|
694
694
|
"Cannot toggle between light and dark themes when `{0}` is enabled in settings.",
|
|
695
695
|
ThemeSettings.DETECT_COLOR_SCHEME
|
|
696
696
|
));
|
|
697
697
|
notificationService.prompt(Severity.Info, message, [{
|
|
698
|
-
label: ( localize(
|
|
698
|
+
label: ( localize(14207, "Open Settings")),
|
|
699
699
|
run: () => {
|
|
700
700
|
return preferencesService.openUserSettings({
|
|
701
701
|
query: ThemeSettings.DETECT_COLOR_SCHEME
|
|
@@ -734,7 +734,7 @@ registerAction2(class extends Action2 {
|
|
|
734
734
|
constructor() {
|
|
735
735
|
super({
|
|
736
736
|
id: browseColorThemesInMarketplaceCommandId,
|
|
737
|
-
title: ( localize2(
|
|
737
|
+
title: ( localize2(14208, "Browse Color Themes in Marketplace")),
|
|
738
738
|
category: Categories.Preferences,
|
|
739
739
|
f1: true
|
|
740
740
|
});
|
|
@@ -775,13 +775,13 @@ registerAction2(class extends Action2 {
|
|
|
775
775
|
});
|
|
776
776
|
const ThemesSubMenu = ( new MenuId("ThemesSubMenu"));
|
|
777
777
|
MenuRegistry.appendMenuItem(MenuId.GlobalActivity, {
|
|
778
|
-
title: ( localize(
|
|
778
|
+
title: ( localize(14209, "Themes")),
|
|
779
779
|
submenu: ThemesSubMenu,
|
|
780
780
|
group: "2_configuration",
|
|
781
781
|
order: 7
|
|
782
782
|
});
|
|
783
783
|
MenuRegistry.appendMenuItem(MenuId.MenubarPreferencesMenu, {
|
|
784
|
-
title: ( localize(
|
|
784
|
+
title: ( localize(14210, "&&Themes")),
|
|
785
785
|
submenu: ThemesSubMenu,
|
|
786
786
|
group: "2_configuration",
|
|
787
787
|
order: 7
|
|
@@ -789,21 +789,21 @@ MenuRegistry.appendMenuItem(MenuId.MenubarPreferencesMenu, {
|
|
|
789
789
|
MenuRegistry.appendMenuItem(ThemesSubMenu, {
|
|
790
790
|
command: {
|
|
791
791
|
id: SelectColorThemeCommandId,
|
|
792
|
-
title: ( localize(
|
|
792
|
+
title: ( localize(14178, "Color Theme"))
|
|
793
793
|
},
|
|
794
794
|
order: 1
|
|
795
795
|
});
|
|
796
796
|
MenuRegistry.appendMenuItem(ThemesSubMenu, {
|
|
797
797
|
command: {
|
|
798
798
|
id: SelectFileIconThemeCommandId,
|
|
799
|
-
title: ( localize(
|
|
799
|
+
title: ( localize(14211, "File Icon Theme"))
|
|
800
800
|
},
|
|
801
801
|
order: 2
|
|
802
802
|
});
|
|
803
803
|
MenuRegistry.appendMenuItem(ThemesSubMenu, {
|
|
804
804
|
command: {
|
|
805
805
|
id: SelectProductIconThemeCommandId,
|
|
806
|
-
title: ( localize(
|
|
806
|
+
title: ( localize(14212, "Product Icon Theme"))
|
|
807
807
|
},
|
|
808
808
|
order: 3
|
|
809
809
|
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IColorTheme, IThemingParticipant } from "@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService";
|
|
2
|
+
import { IEnvironmentService } from "@codingame/monaco-vscode-api/vscode/vs/platform/environment/common/environment.service";
|
|
3
|
+
/**
|
|
4
|
+
* Generates CSS content (variables + theming participant rules) for a color theme.
|
|
5
|
+
* Pure function - no DOM side effects.
|
|
6
|
+
*
|
|
7
|
+
* @param theme The color theme to generate CSS for
|
|
8
|
+
* @param scopeSelector CSS selector to scope the rules (e.g. '.monaco-workbench')
|
|
9
|
+
* @param themingParticipants Functions that contribute additional CSS rules (optional)
|
|
10
|
+
* @param environmentService Passed to theming participants (required if themingParticipants is non-empty)
|
|
11
|
+
*/
|
|
12
|
+
export declare function generateColorThemeCSS(theme: IColorTheme, scopeSelector: string, themingParticipants?: readonly IThemingParticipant[], environmentService?: IEnvironmentService): CSSValue;
|
|
13
|
+
/**
|
|
14
|
+
* A typed wrapper for CSS content
|
|
15
|
+
*/
|
|
16
|
+
export declare class CSSValue {
|
|
17
|
+
readonly code: string;
|
|
18
|
+
constructor(code: string);
|
|
19
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
|
|
2
|
+
import { getColorRegistry, asCssVariableName } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colorUtils';
|
|
3
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/baseColors';
|
|
4
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/chartsColors';
|
|
5
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/editorColors';
|
|
6
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/inputColors';
|
|
7
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/listColors';
|
|
8
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/menuColors';
|
|
9
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/minimapColors';
|
|
10
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/miscColors';
|
|
11
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/quickpickColors';
|
|
12
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/searchColors';
|
|
13
|
+
import { getSizeRegistry, asCssVariableName as asCssVariableName$1, sizeValueToCss } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/sizeUtils';
|
|
14
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/sizes/baseSizes';
|
|
15
|
+
|
|
16
|
+
function generateColorThemeCSS(theme, scopeSelector, themingParticipants, environmentService) {
|
|
17
|
+
const cssRules = ( new Set());
|
|
18
|
+
const ruleCollector = {
|
|
19
|
+
addRule: rule => {
|
|
20
|
+
if (!( cssRules.has(rule))) {
|
|
21
|
+
cssRules.add(rule);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
ruleCollector.addRule(`${scopeSelector} { forced-color-adjust: none; }`);
|
|
26
|
+
if (themingParticipants && environmentService) {
|
|
27
|
+
for (const participant of themingParticipants) {
|
|
28
|
+
participant(theme, ruleCollector, environmentService);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const variables = [];
|
|
32
|
+
for (const item of getColorRegistry().getColors()) {
|
|
33
|
+
const color = theme.getColor(item.id, true);
|
|
34
|
+
if (color) {
|
|
35
|
+
variables.push(`${asCssVariableName(item.id)}: ${( color.toString())};`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
for (const item of getSizeRegistry().getSizes()) {
|
|
39
|
+
const sizeValue = getSizeRegistry().resolveDefaultSize(item.id, theme);
|
|
40
|
+
if (sizeValue) {
|
|
41
|
+
variables.push(`${asCssVariableName$1(item.id)}: ${sizeValueToCss(sizeValue)};`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
ruleCollector.addRule(`${scopeSelector} { ${variables.join("\n")} }`);
|
|
45
|
+
return ( new CSSValue([...cssRules].join("\n")));
|
|
46
|
+
}
|
|
47
|
+
class CSSValue {
|
|
48
|
+
constructor(code) {
|
|
49
|
+
this.code = code;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export { CSSValue, generateColorThemeCSS };
|
|
@@ -149,12 +149,12 @@ class FileIconThemeLoader {
|
|
|
149
149
|
const contentValue = parse(content, errors);
|
|
150
150
|
if (errors.length > 0) {
|
|
151
151
|
return Promise.reject(( new Error(( localize(
|
|
152
|
-
|
|
152
|
+
15831,
|
|
153
153
|
"Problems parsing file icons file: {0}",
|
|
154
154
|
( errors.map(e => getParseErrorMessage(e.error))).join(", ")
|
|
155
155
|
)))));
|
|
156
156
|
} else if (getNodeType(contentValue) !== "object") {
|
|
157
|
-
return Promise.reject(( new Error(( localize(
|
|
157
|
+
return Promise.reject(( new Error(( localize(15832, "Invalid format for file icons theme file: Object expected.")))));
|
|
158
158
|
}
|
|
159
159
|
return Promise.resolve(contentValue);
|
|
160
160
|
});
|
|
@@ -43,7 +43,7 @@ class ProductIconThemeData {
|
|
|
43
43
|
this.isLoaded = true;
|
|
44
44
|
if (warnings.length) {
|
|
45
45
|
logService.error(( localize(
|
|
46
|
-
|
|
46
|
+
15833,
|
|
47
47
|
"Problems processing product icons definitions in {0}:\n{1}",
|
|
48
48
|
(location.toString()),
|
|
49
49
|
warnings.join("\n")
|
|
@@ -76,7 +76,7 @@ class ProductIconThemeData {
|
|
|
76
76
|
static get defaultTheme() {
|
|
77
77
|
let themeData = ProductIconThemeData._defaultProductIconTheme;
|
|
78
78
|
if (!themeData) {
|
|
79
|
-
themeData = ProductIconThemeData._defaultProductIconTheme = ( new ProductIconThemeData(DEFAULT_PRODUCT_ICON_THEME_ID, ( localize(
|
|
79
|
+
themeData = ProductIconThemeData._defaultProductIconTheme = ( new ProductIconThemeData(DEFAULT_PRODUCT_ICON_THEME_ID, ( localize(15834, "Default")), ThemeSettingDefaults.PRODUCT_ICON_THEME));
|
|
80
80
|
themeData.isLoaded = true;
|
|
81
81
|
themeData.extensionData = undefined;
|
|
82
82
|
themeData.watch = false;
|
|
@@ -187,15 +187,15 @@ function _loadProductIconThemeDocument(fileService, location, warnings) {
|
|
|
187
187
|
const contentValue = parse(content, parseErrors);
|
|
188
188
|
if (parseErrors.length > 0) {
|
|
189
189
|
return Promise.reject(( new Error(( localize(
|
|
190
|
-
|
|
190
|
+
15835,
|
|
191
191
|
"Problems parsing product icons file: {0}",
|
|
192
192
|
( parseErrors.map(e => getParseErrorMessage(e.error))).join(", ")
|
|
193
193
|
)))));
|
|
194
194
|
} else if (getNodeType(contentValue) !== "object") {
|
|
195
|
-
return Promise.reject(( new Error(( localize(
|
|
195
|
+
return Promise.reject(( new Error(( localize(15836, "Invalid format for product icons theme file: Object expected.")))));
|
|
196
196
|
} else if (!contentValue.iconDefinitions || !Array.isArray(contentValue.fonts) || !contentValue.fonts.length) {
|
|
197
197
|
return Promise.reject(( new Error(( localize(
|
|
198
|
-
|
|
198
|
+
15837,
|
|
199
199
|
"Invalid format for product icons theme file: Must contain iconDefinitions and fonts."
|
|
200
200
|
)))));
|
|
201
201
|
}
|
|
@@ -208,13 +208,13 @@ function _loadProductIconThemeDocument(fileService, location, warnings) {
|
|
|
208
208
|
if (isString(font.weight) && font.weight.match(fontWeightRegex)) {
|
|
209
209
|
fontWeight = font.weight;
|
|
210
210
|
} else {
|
|
211
|
-
warnings.push(( localize(
|
|
211
|
+
warnings.push(( localize(15838, "Invalid font weight in font '{0}'. Ignoring setting.", font.id)));
|
|
212
212
|
}
|
|
213
213
|
let fontStyle = undefined;
|
|
214
214
|
if (isString(font.style) && font.style.match(fontStyleRegex)) {
|
|
215
215
|
fontStyle = font.style;
|
|
216
216
|
} else {
|
|
217
|
-
warnings.push(( localize(
|
|
217
|
+
warnings.push(( localize(15839, "Invalid font style in font '{0}'. Ignoring setting.", font.id)));
|
|
218
218
|
}
|
|
219
219
|
const sanitizedSrc = [];
|
|
220
220
|
if (Array.isArray(font.src)) {
|
|
@@ -226,7 +226,7 @@ function _loadProductIconThemeDocument(fileService, location, warnings) {
|
|
|
226
226
|
format: s.format
|
|
227
227
|
});
|
|
228
228
|
} else {
|
|
229
|
-
warnings.push(( localize(
|
|
229
|
+
warnings.push(( localize(15840, "Invalid font source in font '{0}'. Ignoring source.", font.id)));
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
232
|
}
|
|
@@ -238,14 +238,14 @@ function _loadProductIconThemeDocument(fileService, location, warnings) {
|
|
|
238
238
|
});
|
|
239
239
|
} else {
|
|
240
240
|
warnings.push(( localize(
|
|
241
|
-
|
|
241
|
+
15841,
|
|
242
242
|
"No valid font source in font '{0}'. Ignoring font definition.",
|
|
243
243
|
font.id
|
|
244
244
|
)));
|
|
245
245
|
}
|
|
246
246
|
} else {
|
|
247
247
|
warnings.push(( localize(
|
|
248
|
-
|
|
248
|
+
15842,
|
|
249
249
|
"Missing or invalid font id '{0}'. Skipping font definition.",
|
|
250
250
|
font.id
|
|
251
251
|
)));
|
|
@@ -268,10 +268,10 @@ function _loadProductIconThemeDocument(fileService, location, warnings) {
|
|
|
268
268
|
font
|
|
269
269
|
});
|
|
270
270
|
} else {
|
|
271
|
-
warnings.push(( localize(
|
|
271
|
+
warnings.push(( localize(15843, "Skipping icon definition '{0}'. Unknown font.", iconId)));
|
|
272
272
|
}
|
|
273
273
|
} else {
|
|
274
|
-
warnings.push(( localize(
|
|
274
|
+
warnings.push(( localize(15844, "Skipping icon definition '{0}': Needs to be defined", iconId)));
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
277
|
return {
|
|
@@ -38,7 +38,7 @@ import { IHostColorSchemeService } from '@codingame/monaco-vscode-api/vscode/vs/
|
|
|
38
38
|
import { Sequencer, RunOnceScheduler } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
39
39
|
import { IUserDataInitializationService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/userData/browser/userDataInit.service';
|
|
40
40
|
import { getIconsStyleSheet } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/browser/iconsStyleSheet';
|
|
41
|
-
import { getColorRegistry
|
|
41
|
+
import { getColorRegistry } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colorUtils';
|
|
42
42
|
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/baseColors';
|
|
43
43
|
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/chartsColors';
|
|
44
44
|
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/editorColors';
|
|
@@ -49,10 +49,9 @@ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/mini
|
|
|
49
49
|
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/miscColors';
|
|
50
50
|
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/quickpickColors';
|
|
51
51
|
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/searchColors';
|
|
52
|
-
import { getSizeRegistry, asCssVariableName as asCssVariableName$1, sizeValueToCss } from '../../../../platform/theme/common/sizeUtils.js';
|
|
53
|
-
import '../../../../platform/theme/common/sizes/baseSizes.js';
|
|
54
52
|
import { ILanguageService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/language.service';
|
|
55
53
|
import { mainWindow } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/window';
|
|
54
|
+
import { generateColorThemeCSS } from './colorThemeCss.js';
|
|
56
55
|
|
|
57
56
|
const defaultThemeExtensionId = "vscode-theme-defaults";
|
|
58
57
|
const DEFAULT_FILE_ICON_THEME_ID = "vscode.vscode-theme-seti-vs-seti";
|
|
@@ -107,9 +106,9 @@ let WorkbenchThemeService = class WorkbenchThemeService extends Disposable {
|
|
|
107
106
|
this.settings = ( new ThemeConfiguration(configurationService, hostColorService));
|
|
108
107
|
this.colorThemeRegistry = this._register(( new ThemeRegistry(colorThemesExtPoint, ColorThemeData.fromExtensionTheme)));
|
|
109
108
|
this.colorThemeWatcher = this._register(( new ThemeFileWatcher(fileService, environmentService, this.reloadCurrentColorTheme.bind(this))));
|
|
110
|
-
this.onColorThemeChange = ( new Emitter({
|
|
109
|
+
this.onColorThemeChange = this._register(( new Emitter({
|
|
111
110
|
leakWarningThreshold: 400
|
|
112
|
-
}));
|
|
111
|
+
})));
|
|
113
112
|
this.currentColorTheme = ColorThemeData.createUnloadedTheme("");
|
|
114
113
|
this.colorThemeSequencer = ( new Sequencer());
|
|
115
114
|
this.fileIconThemeWatcher = this._register(( new ThemeFileWatcher(
|
|
@@ -124,9 +123,9 @@ let WorkbenchThemeService = class WorkbenchThemeService extends Disposable {
|
|
|
124
123
|
FileIconThemeData.noIconTheme
|
|
125
124
|
)));
|
|
126
125
|
this.fileIconThemeLoader = ( new FileIconThemeLoader(extensionResourceLoaderService, languageService));
|
|
127
|
-
this.onFileIconThemeChange = ( new Emitter({
|
|
126
|
+
this.onFileIconThemeChange = this._register(( new Emitter({
|
|
128
127
|
leakWarningThreshold: 400
|
|
129
|
-
}));
|
|
128
|
+
})));
|
|
130
129
|
this.currentFileIconTheme = FileIconThemeData.createUnloadedTheme("");
|
|
131
130
|
this.fileIconThemeSequencer = ( new Sequencer());
|
|
132
131
|
this.productIconThemeWatcher = this._register(( new ThemeFileWatcher(
|
|
@@ -140,7 +139,7 @@ let WorkbenchThemeService = class WorkbenchThemeService extends Disposable {
|
|
|
140
139
|
true,
|
|
141
140
|
ProductIconThemeData.defaultTheme
|
|
142
141
|
)));
|
|
143
|
-
this.onProductIconThemeChange = ( new Emitter());
|
|
142
|
+
this.onProductIconThemeChange = this._register(( new Emitter()));
|
|
144
143
|
this.currentProductIconTheme = ProductIconThemeData.createUnloadedTheme("");
|
|
145
144
|
this.productIconThemeSequencer = ( new Sequencer());
|
|
146
145
|
this._register(
|
|
@@ -394,7 +393,7 @@ let WorkbenchThemeService = class WorkbenchThemeService extends Disposable {
|
|
|
394
393
|
return this.applyTheme(themeData, settingsTarget);
|
|
395
394
|
} catch (error) {
|
|
396
395
|
throw ( new Error(( localize(
|
|
397
|
-
|
|
396
|
+
15845,
|
|
398
397
|
"Unable to load {0}: {1}",
|
|
399
398
|
themeData.location?.toString(),
|
|
400
399
|
error.message
|
|
@@ -431,34 +430,13 @@ let WorkbenchThemeService = class WorkbenchThemeService extends Disposable {
|
|
|
431
430
|
});
|
|
432
431
|
}
|
|
433
432
|
updateDynamicCSSRules(themeData) {
|
|
434
|
-
const
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
};
|
|
442
|
-
ruleCollector.addRule(`.monaco-workbench { forced-color-adjust: none; }`);
|
|
443
|
-
themingRegistry.getThemingParticipants().forEach(p => p(themeData, ruleCollector, this.environmentService));
|
|
444
|
-
const colorVariables = [];
|
|
445
|
-
for (const item of getColorRegistry().getColors()) {
|
|
446
|
-
const color = themeData.getColor(item.id, true);
|
|
447
|
-
if (color) {
|
|
448
|
-
colorVariables.push(`${asCssVariableName(item.id)}: ${( color.toString())};`);
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
const sizeVariables = [];
|
|
452
|
-
for (const item of getSizeRegistry().getSizes()) {
|
|
453
|
-
const sizeValue = getSizeRegistry().resolveDefaultSize(item.id, themeData);
|
|
454
|
-
if (sizeValue) {
|
|
455
|
-
sizeVariables.push(`${asCssVariableName$1(item.id)}: ${sizeValueToCss(sizeValue)};`);
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
ruleCollector.addRule(
|
|
459
|
-
`.monaco-workbench { ${(colorVariables.concat(sizeVariables)).join("\n")} }`
|
|
433
|
+
const css = generateColorThemeCSS(
|
|
434
|
+
themeData,
|
|
435
|
+
".monaco-workbench",
|
|
436
|
+
themingRegistry.getThemingParticipants(),
|
|
437
|
+
this.environmentService
|
|
460
438
|
);
|
|
461
|
-
_applyRules(
|
|
439
|
+
_applyRules(css.code, colorThemeRulesClassName);
|
|
462
440
|
}
|
|
463
441
|
applyTheme(newTheme, settingsTarget, silent = false) {
|
|
464
442
|
this.updateDynamicCSSRules(newTheme);
|