@codingame/monaco-vscode-theme-service-override 4.5.2 → 5.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-theme-service-override",
3
- "version": "4.5.2",
3
+ "version": "5.0.0",
4
4
  "keywords": [],
5
5
  "author": {
6
6
  "name": "CodinGame",
@@ -26,7 +26,7 @@
26
26
  }
27
27
  },
28
28
  "dependencies": {
29
- "vscode": "npm:@codingame/monaco-vscode-api@4.5.2",
30
- "@codingame/monaco-vscode-files-service-override": "4.5.2"
29
+ "vscode": "npm:@codingame/monaco-vscode-api@5.0.0",
30
+ "@codingame/monaco-vscode-files-service-override": "5.0.0"
31
31
  }
32
32
  }
@@ -51,6 +51,10 @@ import { isWeb } from 'vscode/vscode/vs/base/common/platform';
51
51
  import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry.service';
52
52
  import { IHostService } from 'vscode/vscode/vs/workbench/services/host/browser/host.service';
53
53
  import { mainWindow } from 'vscode/vscode/vs/base/browser/window';
54
+ import { IPreferencesService } from 'vscode/vscode/vs/workbench/services/preferences/common/preferences.service';
55
+ import { Toggle } from 'vscode/vscode/vs/base/browser/ui/toggle/toggle';
56
+ import { defaultToggleStyles } from 'vscode/vscode/vs/platform/theme/browser/defaultStyles';
57
+ import { DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
54
58
  import Severity$1 from 'vscode/vscode/vs/base/common/severity';
55
59
 
56
60
  var DefaultThemeUpdatedNotificationContribution_1;
@@ -60,6 +64,12 @@ const manageExtensionIcon = registerIcon('theme-selection-manage-extension', Cod
60
64
  0,
61
65
  'Icon for the \'Manage\' action in the theme selection quick pick.'
62
66
  )));
67
+ var ConfigureItem;
68
+ ( ((function(ConfigureItem) {
69
+ ConfigureItem["BROWSE_GALLERY"] = "marketplace";
70
+ ConfigureItem["EXTENSIONS_VIEW"] = "extensions";
71
+ ConfigureItem["CUSTOM_TOP_ENTRY"] = "customTopEntry";
72
+ })(ConfigureItem || (ConfigureItem = {}))));
63
73
  let MarketplaceThemesPicker = class MarketplaceThemesPicker {
64
74
  constructor(getMarketplaceColorThemes, marketplaceQuery, extensionGalleryService, extensionManagementService, quickInputService, logService, progressService, paneCompositeService, dialogService) {
65
75
  this.getMarketplaceColorThemes = getMarketplaceColorThemes;
@@ -283,11 +293,8 @@ MarketplaceThemesPicker = ( (__decorate([
283
293
  ( (__param(8, IDialogService)))
284
294
  ], MarketplaceThemesPicker)));
285
295
  let InstalledThemesPicker = class InstalledThemesPicker {
286
- constructor(installMessage, browseMessage, placeholderMessage, marketplaceTag, setTheme, getMarketplaceColorThemes, quickInputService, extensionGalleryService, paneCompositeService, extensionResourceLoaderService, instantiationService) {
287
- this.installMessage = installMessage;
288
- this.browseMessage = browseMessage;
289
- this.placeholderMessage = placeholderMessage;
290
- this.marketplaceTag = marketplaceTag;
296
+ constructor(options, setTheme, getMarketplaceColorThemes, quickInputService, extensionGalleryService, paneCompositeService, extensionResourceLoaderService, instantiationService) {
297
+ this.options = options;
291
298
  this.setTheme = setTheme;
292
299
  this.getMarketplaceColorThemes = getMarketplaceColorThemes;
293
300
  this.quickInputService = quickInputService;
@@ -299,12 +306,12 @@ let InstalledThemesPicker = class InstalledThemesPicker {
299
306
  async openQuickPick(picks, currentTheme) {
300
307
  let marketplaceThemePicker;
301
308
  if (this.extensionGalleryService.isEnabled()) {
302
- if (this.extensionResourceLoaderService.supportsExtensionGalleryResources && this.browseMessage) {
303
- marketplaceThemePicker = this.instantiationService.createInstance(MarketplaceThemesPicker, this.getMarketplaceColorThemes.bind(this), this.marketplaceTag);
304
- picks = [...configurationEntries(this.browseMessage), ...picks];
309
+ if (this.extensionResourceLoaderService.supportsExtensionGalleryResources && this.options.browseMessage) {
310
+ marketplaceThemePicker = this.instantiationService.createInstance(MarketplaceThemesPicker, this.getMarketplaceColorThemes.bind(this), this.options.marketplaceTag);
311
+ picks = [configurationEntry(this.options.browseMessage, ConfigureItem.BROWSE_GALLERY), ...picks];
305
312
  }
306
313
  else {
307
- picks = [...picks, ...configurationEntries(this.installMessage)];
314
+ picks = [...picks, { type: 'separator' }, configurationEntry(this.options.installMessage, ConfigureItem.EXTENSIONS_VIEW)];
308
315
  }
309
316
  }
310
317
  let selectThemeTimeout;
@@ -325,25 +332,34 @@ let InstalledThemesPicker = class InstalledThemesPicker {
325
332
  return (
326
333
  (new Promise((s, _) => {
327
334
  let isCompleted = false;
335
+ const disposables = ( (new DisposableStore()));
328
336
  const autoFocusIndex = picks.findIndex(p => isItem(p) && p.id === activeItemId);
329
337
  const quickpick = this.quickInputService.createQuickPick();
330
338
  quickpick.items = picks;
331
- quickpick.placeholder = this.placeholderMessage;
339
+ quickpick.title = this.options.title;
340
+ quickpick.description = this.options.description;
341
+ quickpick.placeholder = this.options.placeholderMessage;
332
342
  quickpick.activeItems = [picks[autoFocusIndex]];
333
343
  quickpick.canSelectMany = false;
344
+ quickpick.toggles = this.options.toggles;
345
+ quickpick.toggles?.forEach(toggle => {
346
+ toggle.onChange(() => this.options.onToggle?.(toggle, quickpick), undefined, disposables);
347
+ });
334
348
  quickpick.matchOnDescription = true;
335
349
  quickpick.onDidAccept(async (_) => {
336
350
  isCompleted = true;
337
351
  const theme = quickpick.selectedItems[0];
338
- if (!theme || typeof theme.id === 'undefined') {
339
- if (marketplaceThemePicker) {
340
- const res = await marketplaceThemePicker.openQuickPick(quickpick.value, currentTheme, selectTheme);
341
- if (res === 'back') {
342
- await pickInstalledThemes(undefined);
343
- }
352
+ if (!theme || theme.configureItem) {
353
+ if (!theme || theme.configureItem === ConfigureItem.EXTENSIONS_VIEW) {
354
+ openExtensionViewlet(this.paneCompositeService, `${this.options.marketplaceTag} ${quickpick.value}`);
344
355
  }
345
- else {
346
- openExtensionViewlet(this.paneCompositeService, `${this.marketplaceTag} ${quickpick.value}`);
356
+ else if (theme.configureItem === ConfigureItem.BROWSE_GALLERY) {
357
+ if (marketplaceThemePicker) {
358
+ const res = await marketplaceThemePicker.openQuickPick(quickpick.value, currentTheme, selectTheme);
359
+ if (res === 'back') {
360
+ await pickInstalledThemes(undefined);
361
+ }
362
+ }
347
363
  }
348
364
  }
349
365
  else {
@@ -359,6 +375,7 @@ let InstalledThemesPicker = class InstalledThemesPicker {
359
375
  s();
360
376
  }
361
377
  quickpick.dispose();
378
+ disposables.dispose();
362
379
  });
363
380
  quickpick.onDidTriggerItemButton(e => {
364
381
  if (isItem(e.item)) {
@@ -367,7 +384,7 @@ let InstalledThemesPicker = class InstalledThemesPicker {
367
384
  openExtensionViewlet(this.paneCompositeService, `@id:${extensionId}`);
368
385
  }
369
386
  else {
370
- openExtensionViewlet(this.paneCompositeService, `${this.marketplaceTag} ${quickpick.value}`);
387
+ openExtensionViewlet(this.paneCompositeService, `${this.options.marketplaceTag} ${quickpick.value}`);
371
388
  }
372
389
  }
373
390
  });
@@ -380,11 +397,11 @@ let InstalledThemesPicker = class InstalledThemesPicker {
380
397
  }
381
398
  };
382
399
  InstalledThemesPicker = ( (__decorate([
383
- ( (__param(6, IQuickInputService))),
384
- ( (__param(7, IExtensionGalleryService))),
385
- ( (__param(8, IPaneCompositePartService))),
386
- ( (__param(9, IExtensionResourceLoaderService))),
387
- ( (__param(10, IInstantiationService)))
400
+ ( (__param(3, IQuickInputService))),
401
+ ( (__param(4, IExtensionGalleryService))),
402
+ ( (__param(5, IPaneCompositePartService))),
403
+ ( (__param(6, IExtensionResourceLoaderService))),
404
+ ( (__param(7, IInstantiationService)))
388
405
  ], InstalledThemesPicker)));
389
406
  const SelectColorThemeCommandId = 'workbench.action.selectTheme';
390
407
  registerAction2(class extends Action2 {
@@ -400,23 +417,71 @@ registerAction2(class extends Action2 {
400
417
  }
401
418
  });
402
419
  }
420
+ getTitle(colorScheme) {
421
+ switch (colorScheme) {
422
+ case ColorScheme.DARK: return ( localizeWithPath(_moduleId, 7, "Select Color Theme for System Dark Mode"));
423
+ case ColorScheme.LIGHT: return ( localizeWithPath(_moduleId, 8, "Select Color Theme for System Light Mode"));
424
+ case ColorScheme.HIGH_CONTRAST_DARK: return ( localizeWithPath(_moduleId, 9, "Select Color Theme for High Contrast Dark Mode"));
425
+ case ColorScheme.HIGH_CONTRAST_LIGHT: return ( localizeWithPath(_moduleId, 10, "Select Color Theme for High Contrast Light Mode"));
426
+ default:
427
+ return ( localizeWithPath(_moduleId, 11, "Select Color Theme (detect system color mode disabled)"));
428
+ }
429
+ }
403
430
  async run(accessor) {
404
431
  const themeService = accessor.get(IWorkbenchThemeService);
405
- const installMessage = ( localizeWithPath(_moduleId, 7, "Install Additional Color Themes..."));
406
- const browseMessage = '$(plus) ' + ( localizeWithPath(_moduleId, 8, "Browse Additional Color Themes..."));
407
- const placeholderMessage = ( localizeWithPath(_moduleId, 9, "Select Color Theme (Up/Down Keys to Preview)"));
408
- const marketplaceTag = 'category:themes';
432
+ const preferencesService = accessor.get(IPreferencesService);
433
+ const preferredColorScheme = themeService.getPreferredColorScheme();
434
+ let modeConfigureToggle;
435
+ if (preferredColorScheme) {
436
+ modeConfigureToggle = ( (new Toggle({
437
+ title: ( localizeWithPath(_moduleId, 12, 'Detect system color mode enabled. Click to configure.')),
438
+ icon: Codicon.colorMode,
439
+ isChecked: false,
440
+ ...defaultToggleStyles
441
+ })));
442
+ }
443
+ else {
444
+ modeConfigureToggle = ( (new Toggle({
445
+ title: ( localizeWithPath(_moduleId, 13, 'Detect system color mode disabled. Click to configure.')),
446
+ icon: Codicon.colorMode,
447
+ isChecked: false,
448
+ ...defaultToggleStyles
449
+ })));
450
+ }
451
+ const options = {
452
+ installMessage: ( localizeWithPath(_moduleId, 14, "Install Additional Color Themes...")),
453
+ browseMessage: '$(plus) ' + ( localizeWithPath(_moduleId, 15, "Browse Additional Color Themes...")),
454
+ placeholderMessage: this.getTitle(preferredColorScheme),
455
+ marketplaceTag: 'category:themes',
456
+ toggles: [modeConfigureToggle],
457
+ onToggle: async (toggle, picker) => {
458
+ picker.hide();
459
+ await preferencesService.openSettings({ query: ThemeSettings.DETECT_COLOR_SCHEME });
460
+ }
461
+ };
409
462
  const setTheme = (theme, settingsTarget) => themeService.setColorTheme(theme, settingsTarget);
410
463
  const getMarketplaceColorThemes = (publisher, name, version) => themeService.getMarketplaceColorThemes(publisher, name, version);
411
464
  const instantiationService = accessor.get(IInstantiationService);
412
- const picker = instantiationService.createInstance(InstalledThemesPicker, installMessage, browseMessage, placeholderMessage, marketplaceTag, setTheme, getMarketplaceColorThemes);
465
+ const picker = instantiationService.createInstance(InstalledThemesPicker, options, setTheme, getMarketplaceColorThemes);
413
466
  const themes = await themeService.getColorThemes();
414
467
  const currentTheme = themeService.getColorTheme();
415
- const picks = [
416
- ...toEntries(themes.filter(t => t.type === ColorScheme.LIGHT), ( localizeWithPath(_moduleId, 10, "light themes"))),
417
- ...toEntries(themes.filter(t => t.type === ColorScheme.DARK), ( localizeWithPath(_moduleId, 11, "dark themes"))),
418
- ...toEntries(themes.filter(t => isHighContrast(t.type)), ( localizeWithPath(_moduleId, 12, "high contrast themes"))),
419
- ];
468
+ const lightEntries = toEntries(themes.filter(t => t.type === ColorScheme.LIGHT), ( localizeWithPath(_moduleId, 16, "light themes")));
469
+ const darkEntries = toEntries(themes.filter(t => t.type === ColorScheme.DARK), ( localizeWithPath(_moduleId, 17, "dark themes")));
470
+ const hcEntries = toEntries(themes.filter(t => isHighContrast(t.type)), ( localizeWithPath(_moduleId, 18, "high contrast themes")));
471
+ let picks;
472
+ switch (preferredColorScheme) {
473
+ case ColorScheme.DARK:
474
+ picks = [...darkEntries, ...lightEntries, ...hcEntries];
475
+ break;
476
+ case ColorScheme.HIGH_CONTRAST_DARK:
477
+ case ColorScheme.HIGH_CONTRAST_LIGHT:
478
+ picks = [...hcEntries, ...lightEntries, ...darkEntries];
479
+ break;
480
+ case ColorScheme.LIGHT:
481
+ default:
482
+ picks = [...lightEntries, ...darkEntries, ...hcEntries];
483
+ break;
484
+ }
420
485
  await picker.openQuickPick(picks, currentTheme);
421
486
  }
422
487
  });
@@ -425,23 +490,25 @@ registerAction2(class extends Action2 {
425
490
  constructor() {
426
491
  super({
427
492
  id: SelectFileIconThemeCommandId,
428
- title: ( localize2WithPath(_moduleId, 13, 'File Icon Theme')),
493
+ title: ( localize2WithPath(_moduleId, 19, 'File Icon Theme')),
429
494
  category: Categories.Preferences,
430
495
  f1: true
431
496
  });
432
497
  }
433
498
  async run(accessor) {
434
499
  const themeService = accessor.get(IWorkbenchThemeService);
435
- const installMessage = ( localizeWithPath(_moduleId, 14, "Install Additional File Icon Themes..."));
436
- const placeholderMessage = ( localizeWithPath(_moduleId, 15, "Select File Icon Theme (Up/Down Keys to Preview)"));
437
- const marketplaceTag = 'tag:icon-theme';
500
+ const options = {
501
+ installMessage: ( localizeWithPath(_moduleId, 20, "Install Additional File Icon Themes...")),
502
+ placeholderMessage: ( localizeWithPath(_moduleId, 21, "Select File Icon Theme (Up/Down Keys to Preview)")),
503
+ marketplaceTag: 'tag:icon-theme'
504
+ };
438
505
  const setTheme = (theme, settingsTarget) => themeService.setFileIconTheme(theme, settingsTarget);
439
506
  const getMarketplaceColorThemes = (publisher, name, version) => themeService.getMarketplaceFileIconThemes(publisher, name, version);
440
507
  const instantiationService = accessor.get(IInstantiationService);
441
- const picker = instantiationService.createInstance(InstalledThemesPicker, installMessage, undefined, placeholderMessage, marketplaceTag, setTheme, getMarketplaceColorThemes);
508
+ const picker = instantiationService.createInstance(InstalledThemesPicker, options, setTheme, getMarketplaceColorThemes);
442
509
  const picks = [
443
- { type: 'separator', label: ( localizeWithPath(_moduleId, 16, 'file icon themes')) },
444
- { id: '', theme: FileIconThemeData.noIconTheme, label: ( localizeWithPath(_moduleId, 17, 'None')), description: ( localizeWithPath(_moduleId, 18, 'Disable File Icons')) },
510
+ { type: 'separator', label: ( localizeWithPath(_moduleId, 22, 'file icon themes')) },
511
+ { id: '', theme: FileIconThemeData.noIconTheme, label: ( localizeWithPath(_moduleId, 23, 'None')), description: ( localizeWithPath(_moduleId, 24, 'Disable File Icons')) },
445
512
  ...toEntries(await themeService.getFileIconThemes()),
446
513
  ];
447
514
  await picker.openQuickPick(picks, themeService.getFileIconTheme());
@@ -452,24 +519,26 @@ registerAction2(class extends Action2 {
452
519
  constructor() {
453
520
  super({
454
521
  id: SelectProductIconThemeCommandId,
455
- title: ( localize2WithPath(_moduleId, 19, 'Product Icon Theme')),
522
+ title: ( localize2WithPath(_moduleId, 25, 'Product Icon Theme')),
456
523
  category: Categories.Preferences,
457
524
  f1: true
458
525
  });
459
526
  }
460
527
  async run(accessor) {
461
528
  const themeService = accessor.get(IWorkbenchThemeService);
462
- const installMessage = ( localizeWithPath(_moduleId, 20, "Install Additional Product Icon Themes..."));
463
- const browseMessage = '$(plus) ' + ( localizeWithPath(_moduleId, 21, "Browse Additional Product Icon Themes..."));
464
- const placeholderMessage = ( localizeWithPath(_moduleId, 22, "Select Product Icon Theme (Up/Down Keys to Preview)"));
465
- const marketplaceTag = 'tag:product-icon-theme';
529
+ const options = {
530
+ installMessage: ( localizeWithPath(_moduleId, 26, "Install Additional Product Icon Themes...")),
531
+ browseMessage: '$(plus) ' + ( localizeWithPath(_moduleId, 27, "Browse Additional Product Icon Themes...")),
532
+ placeholderMessage: ( localizeWithPath(_moduleId, 28, "Select Product Icon Theme (Up/Down Keys to Preview)")),
533
+ marketplaceTag: 'tag:product-icon-theme'
534
+ };
466
535
  const setTheme = (theme, settingsTarget) => themeService.setProductIconTheme(theme, settingsTarget);
467
536
  const getMarketplaceColorThemes = (publisher, name, version) => themeService.getMarketplaceProductIconThemes(publisher, name, version);
468
537
  const instantiationService = accessor.get(IInstantiationService);
469
- const picker = instantiationService.createInstance(InstalledThemesPicker, installMessage, browseMessage, placeholderMessage, marketplaceTag, setTheme, getMarketplaceColorThemes);
538
+ const picker = instantiationService.createInstance(InstalledThemesPicker, options, setTheme, getMarketplaceColorThemes);
470
539
  const picks = [
471
- { type: 'separator', label: ( localizeWithPath(_moduleId, 23, 'product icon themes')) },
472
- { id: DEFAULT_PRODUCT_ICON_THEME_ID, theme: ProductIconThemeData.defaultTheme, label: ( localizeWithPath(_moduleId, 24, 'Default')) },
540
+ { type: 'separator', label: ( localizeWithPath(_moduleId, 29, 'product icon themes')) },
541
+ { id: DEFAULT_PRODUCT_ICON_THEME_ID, theme: ProductIconThemeData.defaultTheme, label: ( localizeWithPath(_moduleId, 30, 'Default')) },
473
542
  ...toEntries(await themeService.getProductIconThemes()),
474
543
  ];
475
544
  await picker.openQuickPick(picks, themeService.getProductIconTheme());
@@ -492,18 +561,14 @@ CommandsRegistry.registerCommand('workbench.action.previewColorTheme', async fun
492
561
  function findBuiltInThemes(themes, extension) {
493
562
  return themes.filter(({ extensionData }) => extensionData && extensionData.extensionIsBuiltin && equalsIgnoreCase(extensionData.extensionPublisher, extension.publisher) && equalsIgnoreCase(extensionData.extensionName, extension.name));
494
563
  }
495
- function configurationEntries(label) {
496
- return [
497
- {
498
- type: 'separator'
499
- },
500
- {
501
- id: undefined,
502
- label: label,
503
- alwaysShow: true,
504
- buttons: [configureButton]
505
- }
506
- ];
564
+ function configurationEntry(label, configureItem) {
565
+ return {
566
+ id: undefined,
567
+ label: label,
568
+ alwaysShow: true,
569
+ buttons: [configureButton],
570
+ configureItem: configureItem
571
+ };
507
572
  }
508
573
  function openExtensionViewlet(paneCompositeService, query) {
509
574
  return paneCompositeService.openPaneComposite(VIEWLET_ID, 0 , true).then(viewlet => {
@@ -539,13 +604,13 @@ function toEntries(themes, label) {
539
604
  }
540
605
  const configureButton = {
541
606
  iconClass: ThemeIcon.asClassName(manageExtensionIcon),
542
- tooltip: ( localizeWithPath(_moduleId, 25, "Manage Extension")),
607
+ tooltip: ( localizeWithPath(_moduleId, 31, "Manage Extension")),
543
608
  };
544
609
  registerAction2(class extends Action2 {
545
610
  constructor() {
546
611
  super({
547
612
  id: 'workbench.action.generateColorTheme',
548
- title: ( localize2WithPath(_moduleId, 26, 'Generate Color Theme From Current Settings')),
613
+ title: ( localize2WithPath(_moduleId, 32, 'Generate Color Theme From Current Settings')),
549
614
  category: Categories.Developer,
550
615
  f1: true
551
616
  });
@@ -595,7 +660,7 @@ registerAction2(class extends Action2 {
595
660
  constructor() {
596
661
  super({
597
662
  id: toggleLightDarkThemesCommandId,
598
- title: ( localize2WithPath(_moduleId, 27, 'Toggle between Light/Dark Themes')),
663
+ title: ( localize2WithPath(_moduleId, 33, 'Toggle between Light/Dark Themes')),
599
664
  category: Categories.Preferences,
600
665
  f1: true,
601
666
  });
@@ -603,6 +668,25 @@ registerAction2(class extends Action2 {
603
668
  async run(accessor) {
604
669
  const themeService = accessor.get(IWorkbenchThemeService);
605
670
  const configurationService = accessor.get(IConfigurationService);
671
+ const notificationService = accessor.get(INotificationService);
672
+ const preferencesService = accessor.get(IPreferencesService);
673
+ if (configurationService.getValue(ThemeSettings.DETECT_COLOR_SCHEME)) {
674
+ const message = ( localizeWithPath(
675
+ _moduleId,
676
+ 34,
677
+ "Cannot toggle between light and dark themes when `{0}` is enabled in settings.",
678
+ ThemeSettings.DETECT_COLOR_SCHEME
679
+ ));
680
+ notificationService.prompt(Severity$1.Info, message, [
681
+ {
682
+ label: ( localizeWithPath(_moduleId, 35, "Open Settings")),
683
+ run: () => {
684
+ return preferencesService.openUserSettings({ query: ThemeSettings.DETECT_COLOR_SCHEME });
685
+ }
686
+ }
687
+ ]);
688
+ return;
689
+ }
606
690
  const currentTheme = themeService.getColorTheme();
607
691
  let newSettingsId = ThemeSettings.PREFERRED_DARK_THEME;
608
692
  switch (currentTheme.type) {
@@ -633,7 +717,7 @@ registerAction2(class extends Action2 {
633
717
  constructor() {
634
718
  super({
635
719
  id: browseColorThemesInMarketplaceCommandId,
636
- title: ( localize2WithPath(_moduleId, 28, 'Browse Color Themes in Marketplace')),
720
+ title: ( localize2WithPath(_moduleId, 36, 'Browse Color Themes in Marketplace')),
637
721
  category: Categories.Preferences,
638
722
  f1: true,
639
723
  });
@@ -669,13 +753,13 @@ registerAction2(class extends Action2 {
669
753
  });
670
754
  const ThemesSubMenu = ( (new MenuId('ThemesSubMenu')));
671
755
  MenuRegistry.appendMenuItem(MenuId.GlobalActivity, {
672
- title: ( localizeWithPath(_moduleId, 29, "Themes")),
756
+ title: ( localizeWithPath(_moduleId, 37, "Themes")),
673
757
  submenu: ThemesSubMenu,
674
758
  group: '2_configuration',
675
759
  order: 7
676
760
  });
677
761
  MenuRegistry.appendMenuItem(MenuId.MenubarPreferencesMenu, {
678
- title: ( localizeWithPath(_moduleId, 30, "&&Theme")),
762
+ title: ( localizeWithPath(_moduleId, 38, "&&Theme")),
679
763
  submenu: ThemesSubMenu,
680
764
  group: '2_configuration',
681
765
  order: 7
@@ -690,14 +774,14 @@ MenuRegistry.appendMenuItem(ThemesSubMenu, {
690
774
  MenuRegistry.appendMenuItem(ThemesSubMenu, {
691
775
  command: {
692
776
  id: SelectFileIconThemeCommandId,
693
- title: ( localizeWithPath(_moduleId, 31, "File Icon Theme"))
777
+ title: ( localizeWithPath(_moduleId, 39, "File Icon Theme"))
694
778
  },
695
779
  order: 2
696
780
  });
697
781
  MenuRegistry.appendMenuItem(ThemesSubMenu, {
698
782
  command: {
699
783
  id: SelectProductIconThemeCommandId,
700
- title: ( localizeWithPath(_moduleId, 32, "Product Icon Theme"))
784
+ title: ( localizeWithPath(_moduleId, 40, "Product Icon Theme"))
701
785
  },
702
786
  order: 3
703
787
  });
@@ -739,20 +823,20 @@ let DefaultThemeUpdatedNotificationContribution = class DefaultThemeUpdatedNotif
739
823
  if (newTheme) {
740
824
  const choices = [
741
825
  {
742
- label: ( localizeWithPath(_moduleId, 33, "Keep New Theme")),
826
+ label: ( localizeWithPath(_moduleId, 41, "Keep New Theme")),
743
827
  run: () => {
744
828
  this._writeTelemetry('keepNew');
745
829
  }
746
830
  },
747
831
  {
748
- label: ( localizeWithPath(_moduleId, 34, "Browse Themes")),
832
+ label: ( localizeWithPath(_moduleId, 42, "Browse Themes")),
749
833
  run: () => {
750
834
  this._writeTelemetry('browse');
751
835
  this._commandService.executeCommand(SelectColorThemeCommandId);
752
836
  }
753
837
  },
754
838
  {
755
- label: ( localizeWithPath(_moduleId, 35, "Revert")),
839
+ label: ( localizeWithPath(_moduleId, 43, "Revert")),
756
840
  run: async () => {
757
841
  this._writeTelemetry('keepOld');
758
842
  const oldSettingsId = usingLight ? ThemeSettingDefaults.COLOR_THEME_LIGHT_OLD : ThemeSettingDefaults.COLOR_THEME_DARK_OLD;
@@ -765,7 +849,7 @@ let DefaultThemeUpdatedNotificationContribution = class DefaultThemeUpdatedNotif
765
849
  ];
766
850
  await this._notificationService.prompt(Severity$1.Info, ( localizeWithPath(
767
851
  _moduleId,
768
- 36,
852
+ 44,
769
853
  "Visual Studio Code now ships with a new default theme '{0}'. If you prefer, you can switch back to the old theme or try one of the many other color themes available.",
770
854
  newTheme.label
771
855
  )), choices, {
@@ -778,21 +862,21 @@ let DefaultThemeUpdatedNotificationContribution = class DefaultThemeUpdatedNotif
778
862
  const theme = (await this._workbenchThemeService.getColorThemes()).find(theme => theme.settingsId === newThemeSettingsId);
779
863
  if (theme) {
780
864
  const choices = [{
781
- label: ( localizeWithPath(_moduleId, 37, "Try New Theme")),
865
+ label: ( localizeWithPath(_moduleId, 45, "Try New Theme")),
782
866
  run: () => {
783
867
  this._writeTelemetry('tryNew');
784
868
  this._workbenchThemeService.setColorTheme(theme, 'auto');
785
869
  }
786
870
  },
787
871
  {
788
- label: ( localizeWithPath(_moduleId, 38, "Cancel")),
872
+ label: ( localizeWithPath(_moduleId, 46, "Cancel")),
789
873
  run: () => {
790
874
  this._writeTelemetry('cancel');
791
875
  }
792
876
  }];
793
877
  await this._notificationService.prompt(Severity$1.Info, ( localizeWithPath(
794
878
  _moduleId,
795
- 39,
879
+ 47,
796
880
  "Visual Studio Code now ships with a new default theme '{0}'. Do you want to give it a try?",
797
881
  theme.label
798
882
  )), choices, { onCancel: () => this._writeTelemetry('cancel') });
@@ -49,8 +49,6 @@ import { ILanguageService } from 'vscode/vscode/vs/editor/common/languages/langu
49
49
  import { mainWindow } from 'vscode/vscode/vs/base/browser/window';
50
50
 
51
51
  const _moduleId = "vs/workbench/services/themes/browser/workbenchThemeService";
52
- const PERSISTED_OS_COLOR_SCHEME = 'osColorScheme';
53
- const PERSISTED_OS_COLOR_SCHEME_SCOPE = -1 ;
54
52
  const defaultThemeExtensionId = 'vscode-theme-defaults';
55
53
  const DEFAULT_FILE_ICON_THEME_ID = 'vscode.vscode-theme-seti-vs-seti';
56
54
  const fileIconsEnabledClass = 'file-icons-enabled';
@@ -85,7 +83,7 @@ let WorkbenchThemeService = class WorkbenchThemeService extends Disposable {
85
83
  this.hasDefaultUpdated = false;
86
84
  this.themeExtensionsActivated = ( new Map());
87
85
  this.container = layoutService.mainContainer;
88
- this.settings = ( new ThemeConfiguration(configurationService));
86
+ this.settings = ( new ThemeConfiguration(configurationService, hostColorService));
89
87
  this.colorThemeRegistry = this._register(( new ThemeRegistry(colorThemesExtPoint, ColorThemeData.fromExtensionTheme)));
90
88
  this.colorThemeWatcher = this._register(( new ThemeFileWatcher(fileService, environmentService, this.reloadCurrentColorTheme.bind(this))));
91
89
  this.onColorThemeChange = ( new Emitter({ leakWarningThreshold: 400 }));
@@ -126,11 +124,7 @@ let WorkbenchThemeService = class WorkbenchThemeService extends Disposable {
126
124
  this.hasDefaultUpdated = themeData.settingsId === ThemeSettingDefaults.COLOR_THEME_DARK_OLD || themeData.settingsId === ThemeSettingDefaults.COLOR_THEME_LIGHT_OLD;
127
125
  themeData = undefined;
128
126
  }
129
- const preferredColorScheme = this.getPreferredColorScheme();
130
127
  const defaultColorMap = colorThemeSetting === ThemeSettingDefaults.COLOR_THEME_LIGHT ? COLOR_THEME_LIGHT_INITIAL_COLORS : colorThemeSetting === ThemeSettingDefaults.COLOR_THEME_DARK ? COLOR_THEME_DARK_INITIAL_COLORS : undefined;
131
- if (preferredColorScheme && themeData?.type !== preferredColorScheme && this.storageService.get(PERSISTED_OS_COLOR_SCHEME, PERSISTED_OS_COLOR_SCHEME_SCOPE) !== preferredColorScheme) {
132
- themeData = ColorThemeData.createUnloadedThemeForThemeType(preferredColorScheme, undefined);
133
- }
134
128
  if (!themeData) {
135
129
  const initialColorTheme = environmentService.options?.initialColorTheme;
136
130
  if (initialColorTheme) {
@@ -175,14 +169,6 @@ let WorkbenchThemeService = class WorkbenchThemeService extends Disposable {
175
169
  const matchedColorTheme = devThemes.find(theme => theme.type === this.currentColorTheme.type);
176
170
  return this.setColorTheme(matchedColorTheme ? matchedColorTheme.id : devThemes[0].id, undefined);
177
171
  }
178
- const preferredColorScheme = this.getPreferredColorScheme();
179
- const prevScheme = this.storageService.get(PERSISTED_OS_COLOR_SCHEME, PERSISTED_OS_COLOR_SCHEME_SCOPE);
180
- if (preferredColorScheme !== prevScheme) {
181
- this.storageService.store(PERSISTED_OS_COLOR_SCHEME, preferredColorScheme, PERSISTED_OS_COLOR_SCHEME_SCOPE, 0 );
182
- if (preferredColorScheme && this.currentColorTheme.type !== preferredColorScheme) {
183
- return this.applyPreferredColorTheme(preferredColorScheme);
184
- }
185
- }
186
172
  let theme = this.colorThemeRegistry.findThemeBySettingsId(this.settings.colorTheme, undefined);
187
173
  if (!theme) {
188
174
  await this.userDataInitializationService.whenInitializationFinished();
@@ -219,31 +205,16 @@ let WorkbenchThemeService = class WorkbenchThemeService extends Disposable {
219
205
  }
220
206
  installConfigurationListener() {
221
207
  this._register(this.configurationService.onDidChangeConfiguration(e => {
222
- let lazyPreferredColorScheme = null;
223
- const getPreferredColorScheme = () => {
224
- if (lazyPreferredColorScheme === null) {
225
- lazyPreferredColorScheme = this.getPreferredColorScheme();
226
- }
227
- return lazyPreferredColorScheme;
228
- };
229
- if (e.affectsConfiguration(ThemeSettings.COLOR_THEME)) {
208
+ if (e.affectsConfiguration(ThemeSettings.COLOR_THEME)
209
+ || e.affectsConfiguration(ThemeSettings.PREFERRED_DARK_THEME)
210
+ || e.affectsConfiguration(ThemeSettings.PREFERRED_LIGHT_THEME)
211
+ || e.affectsConfiguration(ThemeSettings.PREFERRED_HC_DARK_THEME)
212
+ || e.affectsConfiguration(ThemeSettings.PREFERRED_HC_LIGHT_THEME)
213
+ || e.affectsConfiguration(ThemeSettings.DETECT_COLOR_SCHEME)
214
+ || e.affectsConfiguration(ThemeSettings.DETECT_HC)
215
+ || e.affectsConfiguration(ThemeSettings.SYSTEM_COLOR_THEME)) {
230
216
  this.restoreColorTheme();
231
217
  }
232
- if (e.affectsConfiguration(ThemeSettings.DETECT_COLOR_SCHEME) || e.affectsConfiguration(ThemeSettings.DETECT_HC)) {
233
- this.handlePreferredSchemeUpdated();
234
- }
235
- if (e.affectsConfiguration(ThemeSettings.PREFERRED_DARK_THEME) && getPreferredColorScheme() === ColorScheme.DARK) {
236
- this.applyPreferredColorTheme(ColorScheme.DARK);
237
- }
238
- if (e.affectsConfiguration(ThemeSettings.PREFERRED_LIGHT_THEME) && getPreferredColorScheme() === ColorScheme.LIGHT) {
239
- this.applyPreferredColorTheme(ColorScheme.LIGHT);
240
- }
241
- if (e.affectsConfiguration(ThemeSettings.PREFERRED_HC_DARK_THEME) && getPreferredColorScheme() === ColorScheme.HIGH_CONTRAST_DARK) {
242
- this.applyPreferredColorTheme(ColorScheme.HIGH_CONTRAST_DARK);
243
- }
244
- if (e.affectsConfiguration(ThemeSettings.PREFERRED_HC_LIGHT_THEME) && getPreferredColorScheme() === ColorScheme.HIGH_CONTRAST_LIGHT) {
245
- this.applyPreferredColorTheme(ColorScheme.HIGH_CONTRAST_LIGHT);
246
- }
247
218
  if (e.affectsConfiguration(ThemeSettings.FILE_ICON_THEME)) {
248
219
  this.restoreFileIconTheme();
249
220
  }
@@ -332,61 +303,7 @@ let WorkbenchThemeService = class WorkbenchThemeService extends Disposable {
332
303
  });
333
304
  }
334
305
  installPreferredSchemeListener() {
335
- this._register(this.hostColorService.onDidChangeColorScheme(() => this.handlePreferredSchemeUpdated()));
336
- }
337
- async handlePreferredSchemeUpdated() {
338
- const scheme = this.getPreferredColorScheme();
339
- const prevScheme = this.storageService.get(PERSISTED_OS_COLOR_SCHEME, PERSISTED_OS_COLOR_SCHEME_SCOPE);
340
- if (scheme !== prevScheme) {
341
- this.storageService.store(PERSISTED_OS_COLOR_SCHEME, scheme, PERSISTED_OS_COLOR_SCHEME_SCOPE, 1 );
342
- if (scheme) {
343
- if (!prevScheme) {
344
- this.themeSettingIdBeforeSchemeSwitch = this.settings.colorTheme;
345
- }
346
- return this.applyPreferredColorTheme(scheme);
347
- }
348
- else if (prevScheme && this.themeSettingIdBeforeSchemeSwitch) {
349
- const theme = this.colorThemeRegistry.findThemeBySettingsId(this.themeSettingIdBeforeSchemeSwitch, undefined);
350
- if (theme) {
351
- this.setColorTheme(theme.id, 'auto');
352
- }
353
- }
354
- }
355
- return undefined;
356
- }
357
- getPreferredColorScheme() {
358
- if (this.configurationService.getValue(ThemeSettings.DETECT_HC) && this.hostColorService.highContrast) {
359
- return this.hostColorService.dark ? ColorScheme.HIGH_CONTRAST_DARK : ColorScheme.HIGH_CONTRAST_LIGHT;
360
- }
361
- if (this.configurationService.getValue(ThemeSettings.DETECT_COLOR_SCHEME)) {
362
- return this.hostColorService.dark ? ColorScheme.DARK : ColorScheme.LIGHT;
363
- }
364
- return undefined;
365
- }
366
- async applyPreferredColorTheme(type) {
367
- let settingId;
368
- switch (type) {
369
- case ColorScheme.LIGHT:
370
- settingId = ThemeSettings.PREFERRED_LIGHT_THEME;
371
- break;
372
- case ColorScheme.HIGH_CONTRAST_DARK:
373
- settingId = ThemeSettings.PREFERRED_HC_DARK_THEME;
374
- break;
375
- case ColorScheme.HIGH_CONTRAST_LIGHT:
376
- settingId = ThemeSettings.PREFERRED_HC_LIGHT_THEME;
377
- break;
378
- default:
379
- settingId = ThemeSettings.PREFERRED_DARK_THEME;
380
- }
381
- const themeSettingId = this.configurationService.getValue(settingId);
382
- if (themeSettingId && typeof themeSettingId === 'string') {
383
- const theme = this.colorThemeRegistry.findThemeBySettingsId(themeSettingId, undefined);
384
- if (theme) {
385
- const configurationTarget = this.settings.findAutoConfigurationTarget(settingId);
386
- return this.setColorTheme(theme.id, configurationTarget);
387
- }
388
- }
389
- return null;
306
+ this._register(this.hostColorService.onDidChangeColorScheme(() => this.restoreColorTheme()));
390
307
  }
391
308
  hasUpdatedDefaultThemes() {
392
309
  return this.hasDefaultUpdated;
@@ -397,6 +314,9 @@ let WorkbenchThemeService = class WorkbenchThemeService extends Disposable {
397
314
  async getColorThemes() {
398
315
  return this.colorThemeRegistry.getThemes();
399
316
  }
317
+ getPreferredColorScheme() {
318
+ return this.settings.getPreferredColorScheme();
319
+ }
400
320
  async getMarketplaceColorThemes(publisher, name, version) {
401
321
  const extensionLocation = this.extensionResourceLoaderService.getExtensionGalleryResourceURL({ publisher, name, version }, 'extension');
402
322
  if (extensionLocation) {
@@ -15,8 +15,9 @@ import 'vscode/vscode/vs/platform/theme/common/colors/miscColors';
15
15
  import 'vscode/vscode/vs/platform/theme/common/colors/quickpickColors';
16
16
  import 'vscode/vscode/vs/platform/theme/common/colors/searchColors';
17
17
  import { tokenStylingSchemaId } from 'vscode/vscode/vs/platform/theme/common/tokenClassificationRegistry';
18
- import { ThemeSettingDefaults, ThemeSettings } from 'vscode/vscode/vs/workbench/services/themes/common/workbenchThemeService';
18
+ import { ThemeSettings, ThemeSettingDefaults } from 'vscode/vscode/vs/workbench/services/themes/common/workbenchThemeService';
19
19
  import { isWeb } from 'vscode/vscode/vs/base/common/platform';
20
+ import { ColorScheme } from 'vscode/vscode/vs/platform/theme/common/theme';
20
21
 
21
22
  const _moduleId = "vs/workbench/services/themes/common/themeConfiguration";
22
23
  const configurationRegistry = ( (Registry.as(Extensions.Configuration)));
@@ -26,10 +27,17 @@ const colorThemeSettingEnumDescriptions = [];
26
27
  function formatSettingAsLink(str) {
27
28
  return `\`#${str}#\``;
28
29
  }
30
+ const COLOR_THEME_CONFIGURATION_SETTINGS_TAG = 'colorThemeConfiguration';
29
31
  const colorThemeSettingSchema = {
30
32
  type: 'string',
31
- description: ( localizeWithPath(_moduleId, 0, "Specifies the color theme used in the workbench.")),
33
+ markdownDescription: ( localizeWithPath(
34
+ _moduleId,
35
+ 0,
36
+ "Specifies the color theme used in the workbench when {0} is not enabled.",
37
+ formatSettingAsLink(ThemeSettings.DETECT_COLOR_SCHEME)
38
+ )),
32
39
  default: isWeb ? ThemeSettingDefaults.COLOR_THEME_LIGHT : ThemeSettingDefaults.COLOR_THEME_DARK,
40
+ tags: [COLOR_THEME_CONFIGURATION_SETTINGS_TAG],
33
41
  enum: colorThemeSettingEnum,
34
42
  enumDescriptions: colorThemeSettingEnumDescriptions,
35
43
  enumItemLabels: colorThemeSettingEnumItemLabels,
@@ -40,10 +48,11 @@ const preferredDarkThemeSettingSchema = {
40
48
  markdownDescription: ( localizeWithPath(
41
49
  _moduleId,
42
50
  2,
43
- 'Specifies the preferred color theme for dark OS appearance when {0} is enabled.',
51
+ 'Specifies the color theme when system color mode is dark and {0} is enabled.',
44
52
  formatSettingAsLink(ThemeSettings.DETECT_COLOR_SCHEME)
45
53
  )),
46
54
  default: ThemeSettingDefaults.COLOR_THEME_DARK,
55
+ tags: [COLOR_THEME_CONFIGURATION_SETTINGS_TAG],
47
56
  enum: colorThemeSettingEnum,
48
57
  enumDescriptions: colorThemeSettingEnumDescriptions,
49
58
  enumItemLabels: colorThemeSettingEnumItemLabels,
@@ -54,10 +63,11 @@ const preferredLightThemeSettingSchema = {
54
63
  markdownDescription: ( localizeWithPath(
55
64
  _moduleId,
56
65
  3,
57
- 'Specifies the preferred color theme for light OS appearance when {0} is enabled.',
66
+ 'Specifies the color theme when system color mode is light and {0} is enabled.',
58
67
  formatSettingAsLink(ThemeSettings.DETECT_COLOR_SCHEME)
59
68
  )),
60
69
  default: ThemeSettingDefaults.COLOR_THEME_LIGHT,
70
+ tags: [COLOR_THEME_CONFIGURATION_SETTINGS_TAG],
61
71
  enum: colorThemeSettingEnum,
62
72
  enumDescriptions: colorThemeSettingEnumDescriptions,
63
73
  enumItemLabels: colorThemeSettingEnumItemLabels,
@@ -68,10 +78,11 @@ const preferredHCDarkThemeSettingSchema = {
68
78
  markdownDescription: ( localizeWithPath(
69
79
  _moduleId,
70
80
  4,
71
- 'Specifies the preferred color theme used in high contrast dark mode when {0} is enabled.',
81
+ 'Specifies the color theme when in high contrast dark mode and {0} is enabled.',
72
82
  formatSettingAsLink(ThemeSettings.DETECT_HC)
73
83
  )),
74
84
  default: ThemeSettingDefaults.COLOR_THEME_HC_DARK,
85
+ tags: [COLOR_THEME_CONFIGURATION_SETTINGS_TAG],
75
86
  enum: colorThemeSettingEnum,
76
87
  enumDescriptions: colorThemeSettingEnumDescriptions,
77
88
  enumItemLabels: colorThemeSettingEnumItemLabels,
@@ -82,10 +93,11 @@ const preferredHCLightThemeSettingSchema = {
82
93
  markdownDescription: ( localizeWithPath(
83
94
  _moduleId,
84
95
  5,
85
- 'Specifies the preferred color theme used in high contrast light mode when {0} is enabled.',
96
+ 'Specifies the color theme when in high contrast light mode and {0} is enabled.',
86
97
  formatSettingAsLink(ThemeSettings.DETECT_HC)
87
98
  )),
88
99
  default: ThemeSettingDefaults.COLOR_THEME_HC_LIGHT,
100
+ tags: [COLOR_THEME_CONFIGURATION_SETTINGS_TAG],
89
101
  enum: colorThemeSettingEnum,
90
102
  enumDescriptions: colorThemeSettingEnumDescriptions,
91
103
  enumItemLabels: colorThemeSettingEnumItemLabels,
@@ -96,11 +108,12 @@ const detectColorSchemeSettingSchema = {
96
108
  markdownDescription: ( localizeWithPath(
97
109
  _moduleId,
98
110
  6,
99
- 'If set, automatically switch to the preferred color theme based on the OS appearance. If the OS appearance is dark, the theme specified at {0} is used, for light {1}.',
111
+ 'If enabled, will automatically select a color theme based on the system color mode. If the system color mode is dark, {0} is used, else {1}.',
100
112
  formatSettingAsLink(ThemeSettings.PREFERRED_DARK_THEME),
101
113
  formatSettingAsLink(ThemeSettings.PREFERRED_LIGHT_THEME)
102
114
  )),
103
- default: false
115
+ default: false,
116
+ tags: [COLOR_THEME_CONFIGURATION_SETTINGS_TAG],
104
117
  };
105
118
  const colorCustomizationsSchema = {
106
119
  type: 'object',
@@ -143,7 +156,8 @@ const detectHCSchemeSettingSchema = {
143
156
  formatSettingAsLink(ThemeSettings.PREFERRED_HC_DARK_THEME),
144
157
  formatSettingAsLink(ThemeSettings.PREFERRED_HC_LIGHT_THEME)
145
158
  )),
146
- scope: 1
159
+ scope: 1 ,
160
+ tags: [COLOR_THEME_CONFIGURATION_SETTINGS_TAG],
147
161
  };
148
162
  const themeSettingsConfiguration = {
149
163
  id: 'workbench',
@@ -314,12 +328,19 @@ function updateProductIconThemeConfigurationSchemas(themes) {
314
328
  productIconThemeSettingSchema.enumDescriptions.splice(1, Number.MAX_VALUE, ...( (themes.map(t => t.description || ''))));
315
329
  configurationRegistry.notifyConfigurationSchemaUpdated(themeSettingsConfiguration);
316
330
  }
331
+ const colorSchemeToPreferred = {
332
+ [ColorScheme.DARK]: ThemeSettings.PREFERRED_DARK_THEME,
333
+ [ColorScheme.LIGHT]: ThemeSettings.PREFERRED_LIGHT_THEME,
334
+ [ColorScheme.HIGH_CONTRAST_DARK]: ThemeSettings.PREFERRED_HC_DARK_THEME,
335
+ [ColorScheme.HIGH_CONTRAST_LIGHT]: ThemeSettings.PREFERRED_HC_LIGHT_THEME
336
+ };
317
337
  class ThemeConfiguration {
318
- constructor(configurationService) {
338
+ constructor(configurationService, hostColorService) {
319
339
  this.configurationService = configurationService;
340
+ this.hostColorService = hostColorService;
320
341
  }
321
342
  get colorTheme() {
322
- return this.configurationService.getValue(ThemeSettings.COLOR_THEME);
343
+ return this.configurationService.getValue(this.getColorThemeSettingId());
323
344
  }
324
345
  get fileIconTheme() {
325
346
  return this.configurationService.getValue(ThemeSettings.FILE_ICON_THEME);
@@ -336,8 +357,21 @@ class ThemeConfiguration {
336
357
  get semanticTokenColorCustomizations() {
337
358
  return this.configurationService.getValue(ThemeSettings.SEMANTIC_TOKEN_COLOR_CUSTOMIZATIONS);
338
359
  }
360
+ getPreferredColorScheme() {
361
+ if (this.configurationService.getValue(ThemeSettings.DETECT_HC) && this.hostColorService.highContrast) {
362
+ return this.hostColorService.dark ? ColorScheme.HIGH_CONTRAST_DARK : ColorScheme.HIGH_CONTRAST_LIGHT;
363
+ }
364
+ if (this.configurationService.getValue(ThemeSettings.DETECT_COLOR_SCHEME)) {
365
+ return this.hostColorService.dark ? ColorScheme.DARK : ColorScheme.LIGHT;
366
+ }
367
+ return undefined;
368
+ }
369
+ getColorThemeSettingId() {
370
+ const preferredScheme = this.getPreferredColorScheme();
371
+ return preferredScheme ? colorSchemeToPreferred[preferredScheme] : ThemeSettings.COLOR_THEME;
372
+ }
339
373
  async setColorTheme(theme, settingsTarget) {
340
- await this.writeConfiguration(ThemeSettings.COLOR_THEME, theme.settingsId, settingsTarget);
374
+ await this.writeConfiguration(this.getColorThemeSettingId(), theme.settingsId, settingsTarget);
341
375
  return theme;
342
376
  }
343
377
  async setFileIconTheme(theme, settingsTarget) {
@@ -349,7 +383,7 @@ class ThemeConfiguration {
349
383
  return theme;
350
384
  }
351
385
  isDefaultColorTheme() {
352
- const settings = this.configurationService.inspect(ThemeSettings.COLOR_THEME);
386
+ const settings = this.configurationService.inspect(this.getColorThemeSettingId());
353
387
  return settings && settings.default?.value === settings.value;
354
388
  }
355
389
  findAutoConfigurationTarget(key) {
@@ -393,4 +427,4 @@ class ThemeConfiguration {
393
427
  }
394
428
  }
395
429
 
396
- export { ThemeConfiguration, updateColorThemeConfigurationSchemas, updateFileIconThemeConfigurationSchemas, updateProductIconThemeConfigurationSchemas };
430
+ export { COLOR_THEME_CONFIGURATION_SETTINGS_TAG, ThemeConfiguration, formatSettingAsLink, updateColorThemeConfigurationSchemas, updateFileIconThemeConfigurationSchemas, updateProductIconThemeConfigurationSchemas };