material-icon-theme 4.22.0 → 4.23.1

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.
Files changed (84) hide show
  1. package/.eslintrc.json +51 -51
  2. package/.github/workflows/build.yml +45 -45
  3. package/.github/workflows/color-check.yml +22 -22
  4. package/.github/workflows/release.yml +73 -73
  5. package/.vscodeignore +21 -21
  6. package/CHANGELOG.md +1292 -1267
  7. package/README.md +199 -199
  8. package/icons/craco.svg +45 -0
  9. package/icons/folder-changesets-open.svg +5 -0
  10. package/icons/folder-changesets.svg +2 -0
  11. package/icons/folder-decorators-open.svg +2 -2
  12. package/icons/folder-decorators.svg +5 -5
  13. package/icons/folder-supabase-open.svg +5 -5
  14. package/icons/folder-supabase.svg +2 -2
  15. package/icons/sonarcloud.svg +4 -4
  16. package/icons/stylable.svg +10 -10
  17. package/icons/supabase.svg +4 -4
  18. package/icons/vitest.svg +6 -0
  19. package/images/contributors.png +0 -0
  20. package/images/fileIcons.png +0 -0
  21. package/images/folderIcons.png +0 -0
  22. package/package.json +252 -252
  23. package/package.nls.de.json +32 -32
  24. package/package.nls.es.json +29 -29
  25. package/package.nls.fr.json +29 -29
  26. package/package.nls.ja.json +32 -32
  27. package/package.nls.json +32 -32
  28. package/package.nls.nl.json +32 -32
  29. package/package.nls.pl.json +32 -32
  30. package/package.nls.pt-BR.json +29 -29
  31. package/package.nls.pt-PT.json +29 -29
  32. package/package.nls.ru.json +29 -29
  33. package/package.nls.zh-CN.json +29 -29
  34. package/package.nls.zh-TW.json +29 -29
  35. package/src/commands/activate.ts +28 -28
  36. package/src/commands/explorerArrows.ts +55 -55
  37. package/src/commands/folderColor.ts +96 -96
  38. package/src/commands/folders.ts +55 -55
  39. package/src/commands/grayscale.ts +55 -55
  40. package/src/commands/iconPacks.ts +64 -64
  41. package/src/commands/index.ts +30 -30
  42. package/src/commands/opacity.ts +46 -46
  43. package/src/commands/saturation.ts +46 -46
  44. package/src/extension.ts +37 -37
  45. package/src/helpers/customIcons.ts +8 -8
  46. package/src/helpers/index.ts +88 -88
  47. package/src/i18n/index.ts +78 -78
  48. package/src/i18n/lang-de.ts +43 -43
  49. package/src/i18n/lang-en.ts +43 -43
  50. package/src/i18n/lang-es.ts +43 -43
  51. package/src/i18n/lang-fr.ts +43 -43
  52. package/src/i18n/lang-ja.ts +43 -43
  53. package/src/i18n/lang-nl.ts +43 -43
  54. package/src/i18n/lang-pl.ts +43 -43
  55. package/src/i18n/lang-pt-br.ts +43 -43
  56. package/src/i18n/lang-pt-pt.ts +43 -43
  57. package/src/i18n/lang-ru.ts +43 -43
  58. package/src/i18n/lang-uk.ts +43 -43
  59. package/src/i18n/lang-zh-cn.ts +43 -43
  60. package/src/i18n/lang-zh-tw.ts +43 -43
  61. package/src/icons/fileIcons.ts +2197 -2159
  62. package/src/icons/folderIcons.ts +806 -804
  63. package/src/icons/generator/folderGenerator.ts +340 -340
  64. package/src/icons/generator/iconOpacity.ts +111 -111
  65. package/src/icons/generator/iconSaturation.ts +140 -140
  66. package/src/icons/generator/jsonGenerator.ts +191 -191
  67. package/src/icons/languageIcons.ts +141 -141
  68. package/src/models/i18n/translation.ts +41 -41
  69. package/src/models/iconConfiguration.ts +37 -37
  70. package/src/models/icons/iconJsonOptions.ts +21 -21
  71. package/src/models/index.ts +3 -3
  72. package/src/scripts/contributors/index.ts +138 -138
  73. package/src/scripts/helpers/screenshots.ts +32 -32
  74. package/src/scripts/icons/checks/checkIconAvailability.ts +215 -215
  75. package/src/scripts/icons/checks/checkIconConflicts.ts +152 -152
  76. package/src/scripts/icons/checks/checkIconUsage.ts +137 -137
  77. package/src/scripts/icons/checks/index.ts +7 -7
  78. package/src/scripts/preview/index.ts +40 -40
  79. package/src/scripts/preview/preview.ts +163 -163
  80. package/src/test/runTest.ts +26 -26
  81. package/src/test/spec/i18n/i18n.spec.ts +54 -54
  82. package/src/test/spec/icons/fileIcons.spec.ts +250 -250
  83. package/src/test/spec/icons/folderIcons.spec.ts +418 -418
  84. package/src/test/spec/icons/languageIcons.spec.ts +184 -184
@@ -1,29 +1,29 @@
1
- {
2
- "command.activateIcons": "Material Icons: 激活Material Icons文件圖標主題",
3
- "command.toggleIconPacks": "Material Icons: 選擇一個圖標包",
4
- "command.changeFolderTheme": "Material Icons: 切換文件夾圖標",
5
- "command.changeFolderColor": "Material Icons: 更改文件夾顏色",
6
- "command.restoreDefaultConfig": "Material Icons: 恢復默認設置",
7
- "command.toggleExplorerArrows": "Material Icons: 隱藏文件夾箭頭",
8
- "command.changeOpacity": "Material Icons: 改變不透明度",
9
- "configuration.title": "Material Icons",
10
- "configuration.files.associations": "設置自定義文件圖標關聯。",
11
- "configuration.folders.associations": "設置自定義文件夾圖標關聯。",
12
- "configuration.languages.associations": "定義自定義語言映射的圖標。",
13
- "configuration.activeIconPack": "選擇一個圖標包。",
14
- "configuration.activeIconPack.angular": "Angular的圖標。",
15
- "configuration.activeIconPack.angular_ngrx": "Angular和ngrx的圖標。",
16
- "configuration.activeIconPack.react": "React的圖標。",
17
- "configuration.activeIconPack.react_redux": "React和Redux的圖標。",
18
- "configuration.activeIconPack.vue": "Vue的圖標。",
19
- "configuration.activeIconPack.vue_vuex": "Vue和Vuex的圖標。",
20
- "configuration.activeIconPack.nest": "NestJS的圖標。",
21
- "configuration.activeIconPack.none": "沒有啟用圖標包。",
22
- "configuration.folders.theme": "設置文件夾圖標的類型。",
23
- "configuration.folders.theme.specific": "選擇特定文件夾圖標。",
24
- "configuration.folders.theme.classic": "選擇經典文件夾圖標。",
25
- "configuration.folders.theme.none": "沒有文件夾圖標。",
26
- "configuration.folders.color": "更改文件夾圖標的顏色。",
27
- "configuration.hidesExplorerArrows": "隱藏該文件夾旁邊的箭頭。",
28
- "configuration.opacity": "更改圖標的透明度。"
29
- }
1
+ {
2
+ "command.activateIcons": "Material Icons: 激活Material Icons文件圖標主題",
3
+ "command.toggleIconPacks": "Material Icons: 選擇一個圖標包",
4
+ "command.changeFolderTheme": "Material Icons: 切換文件夾圖標",
5
+ "command.changeFolderColor": "Material Icons: 更改文件夾顏色",
6
+ "command.restoreDefaultConfig": "Material Icons: 恢復默認設置",
7
+ "command.toggleExplorerArrows": "Material Icons: 隱藏文件夾箭頭",
8
+ "command.changeOpacity": "Material Icons: 改變不透明度",
9
+ "configuration.title": "Material Icons",
10
+ "configuration.files.associations": "設置自定義文件圖標關聯。",
11
+ "configuration.folders.associations": "設置自定義文件夾圖標關聯。",
12
+ "configuration.languages.associations": "定義自定義語言映射的圖標。",
13
+ "configuration.activeIconPack": "選擇一個圖標包。",
14
+ "configuration.activeIconPack.angular": "Angular的圖標。",
15
+ "configuration.activeIconPack.angular_ngrx": "Angular和ngrx的圖標。",
16
+ "configuration.activeIconPack.react": "React的圖標。",
17
+ "configuration.activeIconPack.react_redux": "React和Redux的圖標。",
18
+ "configuration.activeIconPack.vue": "Vue的圖標。",
19
+ "configuration.activeIconPack.vue_vuex": "Vue和Vuex的圖標。",
20
+ "configuration.activeIconPack.nest": "NestJS的圖標。",
21
+ "configuration.activeIconPack.none": "沒有啟用圖標包。",
22
+ "configuration.folders.theme": "設置文件夾圖標的類型。",
23
+ "configuration.folders.theme.specific": "選擇特定文件夾圖標。",
24
+ "configuration.folders.theme.classic": "選擇經典文件夾圖標。",
25
+ "configuration.folders.theme.none": "沒有文件夾圖標。",
26
+ "configuration.folders.color": "更改文件夾圖標的顏色。",
27
+ "configuration.hidesExplorerArrows": "隱藏該文件夾旁邊的箭頭。",
28
+ "configuration.opacity": "更改圖標的透明度。"
29
+ }
@@ -1,28 +1,28 @@
1
- import { window as codeWindow } from 'vscode';
2
- import { getConfig } from '../helpers';
3
- import { translate } from '../i18n';
4
-
5
- /** Activate the icon theme by changing the settings for the iconTheme. */
6
- export const activateIcons = () => {
7
- return setIconTheme();
8
- };
9
-
10
- /** Set the icon theme in the config. */
11
- const setIconTheme = async () => {
12
- // global user config
13
- try {
14
- await getConfig().update(
15
- 'workbench.iconTheme',
16
- 'material-icon-theme',
17
- true
18
- );
19
-
20
- // local workspace config
21
- if (getConfig().inspect('workbench.iconTheme')?.workspaceValue) {
22
- getConfig().update('workbench.iconTheme', 'material-icon-theme');
23
- }
24
- codeWindow.showInformationMessage(translate('activated'));
25
- } catch (error) {
26
- console.error(error);
27
- }
28
- };
1
+ import { window as codeWindow } from 'vscode';
2
+ import { getConfig } from '../helpers';
3
+ import { translate } from '../i18n';
4
+
5
+ /** Activate the icon theme by changing the settings for the iconTheme. */
6
+ export const activateIcons = () => {
7
+ return setIconTheme();
8
+ };
9
+
10
+ /** Set the icon theme in the config. */
11
+ const setIconTheme = async () => {
12
+ // global user config
13
+ try {
14
+ await getConfig().update(
15
+ 'workbench.iconTheme',
16
+ 'material-icon-theme',
17
+ true
18
+ );
19
+
20
+ // local workspace config
21
+ if (getConfig().inspect('workbench.iconTheme')?.workspaceValue) {
22
+ getConfig().update('workbench.iconTheme', 'material-icon-theme');
23
+ }
24
+ codeWindow.showInformationMessage(translate('activated'));
25
+ } catch (error) {
26
+ console.error(error);
27
+ }
28
+ };
@@ -1,55 +1,55 @@
1
- import { QuickPickItem, window as codeWindow } from 'vscode';
2
- import { getMaterialIconsJSON, setThemeConfig } from '../helpers';
3
- import { translate } from '../i18n';
4
-
5
- /** Command to toggle the explorer arrows. */
6
- export const toggleExplorerArrows = async () => {
7
- try {
8
- const status = checkArrowStatus();
9
- const response = await showQuickPickItems(status);
10
- return handleQuickPickActions(response);
11
- } catch (error) {
12
- console.error(error);
13
- }
14
- };
15
-
16
- /** Show QuickPick items to select preferred configuration for the explorer arrows. */
17
- const showQuickPickItems = (
18
- status: boolean
19
- ): Thenable<QuickPickItem | undefined> => {
20
- const on: QuickPickItem = {
21
- description: translate('toggleSwitch.on'),
22
- detail: translate('explorerArrows.enable'),
23
- label: !status ? '\u2714' : '\u25FB',
24
- };
25
- const off: QuickPickItem = {
26
- description: translate('toggleSwitch.off'),
27
- detail: translate('explorerArrows.disable'),
28
- label: status ? '\u2714' : '\u25FB',
29
- };
30
- return codeWindow.showQuickPick([on, off], {
31
- placeHolder: translate('explorerArrows.toggle'),
32
- ignoreFocusOut: false,
33
- matchOnDescription: true,
34
- });
35
- };
36
-
37
- /** Handle the actions from the QuickPick. */
38
- const handleQuickPickActions = (value: QuickPickItem | undefined) => {
39
- if (!value?.description) return;
40
- switch (value.description) {
41
- case translate('toggleSwitch.on'): {
42
- return setThemeConfig('hidesExplorerArrows', false, true);
43
- }
44
- case translate('toggleSwitch.off'): {
45
- return setThemeConfig('hidesExplorerArrows', true, true);
46
- }
47
- default:
48
- return;
49
- }
50
- };
51
-
52
- /** Check if arrows are enabled. */
53
- export const checkArrowStatus = (): boolean => {
54
- return !!getMaterialIconsJSON()?.hidesExplorerArrows;
55
- };
1
+ import { QuickPickItem, window as codeWindow } from 'vscode';
2
+ import { getMaterialIconsJSON, setThemeConfig } from '../helpers';
3
+ import { translate } from '../i18n';
4
+
5
+ /** Command to toggle the explorer arrows. */
6
+ export const toggleExplorerArrows = async () => {
7
+ try {
8
+ const status = checkArrowStatus();
9
+ const response = await showQuickPickItems(status);
10
+ return handleQuickPickActions(response);
11
+ } catch (error) {
12
+ console.error(error);
13
+ }
14
+ };
15
+
16
+ /** Show QuickPick items to select preferred configuration for the explorer arrows. */
17
+ const showQuickPickItems = (
18
+ status: boolean
19
+ ): Thenable<QuickPickItem | undefined> => {
20
+ const on: QuickPickItem = {
21
+ description: translate('toggleSwitch.on'),
22
+ detail: translate('explorerArrows.enable'),
23
+ label: !status ? '\u2714' : '\u25FB',
24
+ };
25
+ const off: QuickPickItem = {
26
+ description: translate('toggleSwitch.off'),
27
+ detail: translate('explorerArrows.disable'),
28
+ label: status ? '\u2714' : '\u25FB',
29
+ };
30
+ return codeWindow.showQuickPick([on, off], {
31
+ placeHolder: translate('explorerArrows.toggle'),
32
+ ignoreFocusOut: false,
33
+ matchOnDescription: true,
34
+ });
35
+ };
36
+
37
+ /** Handle the actions from the QuickPick. */
38
+ const handleQuickPickActions = (value: QuickPickItem | undefined) => {
39
+ if (!value?.description) return;
40
+ switch (value.description) {
41
+ case translate('toggleSwitch.on'): {
42
+ return setThemeConfig('hidesExplorerArrows', false, true);
43
+ }
44
+ case translate('toggleSwitch.off'): {
45
+ return setThemeConfig('hidesExplorerArrows', true, true);
46
+ }
47
+ default:
48
+ return;
49
+ }
50
+ };
51
+
52
+ /** Check if arrows are enabled. */
53
+ export const checkArrowStatus = (): boolean => {
54
+ return !!getMaterialIconsJSON()?.hidesExplorerArrows;
55
+ };
@@ -1,96 +1,96 @@
1
- import { QuickPickItem, window as codeWindow } from 'vscode';
2
- import { getMaterialIconsJSON, setThemeConfig } from '../helpers';
3
- import { translate } from '../i18n';
4
- import { getDefaultIconOptions, validateHEXColorCode } from '../icons';
5
-
6
- interface FolderColor {
7
- label: string;
8
- hex: string;
9
- }
10
-
11
- const iconPalette: FolderColor[] = [
12
- { label: 'Grey (Default)', hex: '#90a4ae' },
13
- { label: 'Blue', hex: '#42a5f5' },
14
- { label: 'Green', hex: '#7CB342' },
15
- { label: 'Teal', hex: '#26A69A' },
16
- { label: 'Red', hex: '#EF5350' },
17
- { label: 'Orange', hex: '#FF7043' },
18
- { label: 'Yellow', hex: '#FDD835' },
19
- { label: 'Custom Color', hex: 'Custom HEX Code' },
20
- ];
21
-
22
- /** Command to toggle the folder icons. */
23
- export const changeFolderColor = async () => {
24
- try {
25
- const status = checkFolderColorStatus();
26
- const response = await showQuickPickItems(status);
27
- if (response) {
28
- handleQuickPickActions(response);
29
- }
30
- } catch (error) {
31
- console.error(error);
32
- }
33
- };
34
-
35
- /** Show QuickPick items to select preferred color for the folder icons. */
36
- const showQuickPickItems = (currentColor: string) => {
37
- const options = iconPalette.map(
38
- (color): QuickPickItem => ({
39
- description: color.label,
40
- label: isColorActive(color, currentColor) ? '\u2714' : '\u25FB',
41
- })
42
- );
43
-
44
- return codeWindow.showQuickPick(options, {
45
- placeHolder: translate('folders.color'),
46
- ignoreFocusOut: false,
47
- matchOnDescription: true,
48
- });
49
- };
50
-
51
- /** Handle the actions from the QuickPick. */
52
- const handleQuickPickActions = async (value: QuickPickItem) => {
53
- if (!value || !value.description) return;
54
- if (value.description === 'Custom Color') {
55
- const value = await codeWindow.showInputBox({
56
- placeHolder: translate('folders.hexCode'),
57
- ignoreFocusOut: true,
58
- validateInput: validateColorInput,
59
- });
60
- if (value) {
61
- setColorConfig(value);
62
- }
63
- } else {
64
- const hexCode = iconPalette.find((c) => c.label === value.description)?.hex;
65
- if (hexCode) {
66
- setColorConfig(hexCode);
67
- }
68
- }
69
- };
70
-
71
- const validateColorInput = (colorInput: string) => {
72
- if (!validateHEXColorCode(colorInput)) {
73
- return translate('folders.wrongHexCode');
74
- }
75
- return undefined;
76
- };
77
-
78
- /** Check status of the folder color */
79
- export const checkFolderColorStatus = (): string => {
80
- const defaultOptions = getDefaultIconOptions();
81
- const config = getMaterialIconsJSON();
82
- return config?.options?.folders?.color ?? defaultOptions.folders.color!;
83
- };
84
-
85
- const setColorConfig = (value: string) => {
86
- setThemeConfig('folders.color', value.toLowerCase(), true);
87
- };
88
-
89
- const isColorActive = (color: FolderColor, currentColor: string): boolean => {
90
- if (color.label === 'Custom Color') {
91
- return !iconPalette.some(
92
- (c) => c.hex.toLowerCase() === currentColor.toLowerCase()
93
- );
94
- }
95
- return color.hex.toLowerCase() === currentColor.toLowerCase();
96
- };
1
+ import { QuickPickItem, window as codeWindow } from 'vscode';
2
+ import { getMaterialIconsJSON, setThemeConfig } from '../helpers';
3
+ import { translate } from '../i18n';
4
+ import { getDefaultIconOptions, validateHEXColorCode } from '../icons';
5
+
6
+ interface FolderColor {
7
+ label: string;
8
+ hex: string;
9
+ }
10
+
11
+ const iconPalette: FolderColor[] = [
12
+ { label: 'Grey (Default)', hex: '#90a4ae' },
13
+ { label: 'Blue', hex: '#42a5f5' },
14
+ { label: 'Green', hex: '#7CB342' },
15
+ { label: 'Teal', hex: '#26A69A' },
16
+ { label: 'Red', hex: '#EF5350' },
17
+ { label: 'Orange', hex: '#FF7043' },
18
+ { label: 'Yellow', hex: '#FDD835' },
19
+ { label: 'Custom Color', hex: 'Custom HEX Code' },
20
+ ];
21
+
22
+ /** Command to toggle the folder icons. */
23
+ export const changeFolderColor = async () => {
24
+ try {
25
+ const status = checkFolderColorStatus();
26
+ const response = await showQuickPickItems(status);
27
+ if (response) {
28
+ handleQuickPickActions(response);
29
+ }
30
+ } catch (error) {
31
+ console.error(error);
32
+ }
33
+ };
34
+
35
+ /** Show QuickPick items to select preferred color for the folder icons. */
36
+ const showQuickPickItems = (currentColor: string) => {
37
+ const options = iconPalette.map(
38
+ (color): QuickPickItem => ({
39
+ description: color.label,
40
+ label: isColorActive(color, currentColor) ? '\u2714' : '\u25FB',
41
+ })
42
+ );
43
+
44
+ return codeWindow.showQuickPick(options, {
45
+ placeHolder: translate('folders.color'),
46
+ ignoreFocusOut: false,
47
+ matchOnDescription: true,
48
+ });
49
+ };
50
+
51
+ /** Handle the actions from the QuickPick. */
52
+ const handleQuickPickActions = async (value: QuickPickItem) => {
53
+ if (!value || !value.description) return;
54
+ if (value.description === 'Custom Color') {
55
+ const value = await codeWindow.showInputBox({
56
+ placeHolder: translate('folders.hexCode'),
57
+ ignoreFocusOut: true,
58
+ validateInput: validateColorInput,
59
+ });
60
+ if (value) {
61
+ setColorConfig(value);
62
+ }
63
+ } else {
64
+ const hexCode = iconPalette.find((c) => c.label === value.description)?.hex;
65
+ if (hexCode) {
66
+ setColorConfig(hexCode);
67
+ }
68
+ }
69
+ };
70
+
71
+ const validateColorInput = (colorInput: string) => {
72
+ if (!validateHEXColorCode(colorInput)) {
73
+ return translate('folders.wrongHexCode');
74
+ }
75
+ return undefined;
76
+ };
77
+
78
+ /** Check status of the folder color */
79
+ export const checkFolderColorStatus = (): string => {
80
+ const defaultOptions = getDefaultIconOptions();
81
+ const config = getMaterialIconsJSON();
82
+ return config?.options?.folders?.color ?? defaultOptions.folders.color!;
83
+ };
84
+
85
+ const setColorConfig = (value: string) => {
86
+ setThemeConfig('folders.color', value.toLowerCase(), true);
87
+ };
88
+
89
+ const isColorActive = (color: FolderColor, currentColor: string): boolean => {
90
+ if (color.label === 'Custom Color') {
91
+ return !iconPalette.some(
92
+ (c) => c.hex.toLowerCase() === currentColor.toLowerCase()
93
+ );
94
+ }
95
+ return color.hex.toLowerCase() === currentColor.toLowerCase();
96
+ };
@@ -1,55 +1,55 @@
1
- import { QuickPickItem, window as codeWindow } from 'vscode';
2
- import {
3
- capitalizeFirstLetter,
4
- getMaterialIconsJSON,
5
- setThemeConfig,
6
- } from '../helpers';
7
- import { translate } from '../i18n';
8
- import { folderIcons } from '../icons';
9
-
10
- /** Command to toggle the folder icons. */
11
- export const changeFolderTheme = async () => {
12
- try {
13
- const status = getFolderIconTheme();
14
- const response = await showQuickPickItems(status);
15
- if (response) {
16
- handleQuickPickActions(response);
17
- }
18
- } catch (error) {
19
- console.error(error);
20
- }
21
- };
22
-
23
- /** Show QuickPick items to select preferred configuration for the folder icons. */
24
- const showQuickPickItems = (activeTheme: string) => {
25
- const options = folderIcons.map(
26
- (theme): QuickPickItem => ({
27
- description: capitalizeFirstLetter(theme.name),
28
- detail:
29
- theme.name === 'none'
30
- ? translate('folders.disabled')
31
- : translate(
32
- 'folders.theme.description',
33
- capitalizeFirstLetter(theme.name)
34
- ),
35
- label: theme.name === activeTheme ? '\u2714' : '\u25FB',
36
- })
37
- );
38
-
39
- return codeWindow.showQuickPick(options, {
40
- placeHolder: translate('folders.toggleIcons'),
41
- ignoreFocusOut: false,
42
- matchOnDescription: true,
43
- });
44
- };
45
-
46
- /** Handle the actions from the QuickPick. */
47
- const handleQuickPickActions = (value: QuickPickItem) => {
48
- if (!value || !value.description) return;
49
- return setThemeConfig('folders.theme', value.description.toLowerCase(), true);
50
- };
51
-
52
- /** Get the current folder theme. */
53
- export const getFolderIconTheme = (): string => {
54
- return getMaterialIconsJSON()?.options?.folders?.theme ?? '';
55
- };
1
+ import { QuickPickItem, window as codeWindow } from 'vscode';
2
+ import {
3
+ capitalizeFirstLetter,
4
+ getMaterialIconsJSON,
5
+ setThemeConfig,
6
+ } from '../helpers';
7
+ import { translate } from '../i18n';
8
+ import { folderIcons } from '../icons';
9
+
10
+ /** Command to toggle the folder icons. */
11
+ export const changeFolderTheme = async () => {
12
+ try {
13
+ const status = getFolderIconTheme();
14
+ const response = await showQuickPickItems(status);
15
+ if (response) {
16
+ handleQuickPickActions(response);
17
+ }
18
+ } catch (error) {
19
+ console.error(error);
20
+ }
21
+ };
22
+
23
+ /** Show QuickPick items to select preferred configuration for the folder icons. */
24
+ const showQuickPickItems = (activeTheme: string) => {
25
+ const options = folderIcons.map(
26
+ (theme): QuickPickItem => ({
27
+ description: capitalizeFirstLetter(theme.name),
28
+ detail:
29
+ theme.name === 'none'
30
+ ? translate('folders.disabled')
31
+ : translate(
32
+ 'folders.theme.description',
33
+ capitalizeFirstLetter(theme.name)
34
+ ),
35
+ label: theme.name === activeTheme ? '\u2714' : '\u25FB',
36
+ })
37
+ );
38
+
39
+ return codeWindow.showQuickPick(options, {
40
+ placeHolder: translate('folders.toggleIcons'),
41
+ ignoreFocusOut: false,
42
+ matchOnDescription: true,
43
+ });
44
+ };
45
+
46
+ /** Handle the actions from the QuickPick. */
47
+ const handleQuickPickActions = (value: QuickPickItem) => {
48
+ if (!value || !value.description) return;
49
+ return setThemeConfig('folders.theme', value.description.toLowerCase(), true);
50
+ };
51
+
52
+ /** Get the current folder theme. */
53
+ export const getFolderIconTheme = (): string => {
54
+ return getMaterialIconsJSON()?.options?.folders?.theme ?? '';
55
+ };
@@ -1,55 +1,55 @@
1
- import { QuickPickItem, window as codeWindow } from 'vscode';
2
- import { getMaterialIconsJSON, setThemeConfig } from '../helpers';
3
- import { translate } from '../i18n';
4
-
5
- /** Command to toggle grayscale. */
6
- export const toggleGrayscale = async () => {
7
- try {
8
- const status = checkGrayscaleStatus();
9
- const response = await showQuickPickItems(status);
10
- if (response) {
11
- handleQuickPickActions(response);
12
- }
13
- } catch (error) {
14
- console.error(error);
15
- }
16
- };
17
-
18
- /** Show QuickPick items to select preferred configuration for grayscale icons. */
19
- const showQuickPickItems = (status: boolean) => {
20
- const on: QuickPickItem = {
21
- description: translate('toggleSwitch.on'),
22
- detail: translate('grayscale.enable'),
23
- label: status ? '\u2714' : '\u25FB',
24
- };
25
- const off: QuickPickItem = {
26
- description: translate('toggleSwitch.off'),
27
- detail: translate('grayscale.disable'),
28
- label: !status ? '\u2714' : '\u25FB',
29
- };
30
- return codeWindow.showQuickPick([on, off], {
31
- placeHolder: translate('grayscale.toggle'),
32
- ignoreFocusOut: false,
33
- matchOnDescription: true,
34
- });
35
- };
36
-
37
- /** Handle the actions from the QuickPick. */
38
- const handleQuickPickActions = (value: QuickPickItem) => {
39
- if (!value || !value.description) return;
40
- switch (value.description) {
41
- case translate('toggleSwitch.on'): {
42
- return setThemeConfig('saturation', 0, true);
43
- }
44
- case translate('toggleSwitch.off'): {
45
- return setThemeConfig('saturation', 1, true);
46
- }
47
- default:
48
- return;
49
- }
50
- };
51
-
52
- /** Is grayscale icons enabled? */
53
- export const checkGrayscaleStatus = (): boolean => {
54
- return getMaterialIconsJSON()?.options?.saturation === 0;
55
- };
1
+ import { QuickPickItem, window as codeWindow } from 'vscode';
2
+ import { getMaterialIconsJSON, setThemeConfig } from '../helpers';
3
+ import { translate } from '../i18n';
4
+
5
+ /** Command to toggle grayscale. */
6
+ export const toggleGrayscale = async () => {
7
+ try {
8
+ const status = checkGrayscaleStatus();
9
+ const response = await showQuickPickItems(status);
10
+ if (response) {
11
+ handleQuickPickActions(response);
12
+ }
13
+ } catch (error) {
14
+ console.error(error);
15
+ }
16
+ };
17
+
18
+ /** Show QuickPick items to select preferred configuration for grayscale icons. */
19
+ const showQuickPickItems = (status: boolean) => {
20
+ const on: QuickPickItem = {
21
+ description: translate('toggleSwitch.on'),
22
+ detail: translate('grayscale.enable'),
23
+ label: status ? '\u2714' : '\u25FB',
24
+ };
25
+ const off: QuickPickItem = {
26
+ description: translate('toggleSwitch.off'),
27
+ detail: translate('grayscale.disable'),
28
+ label: !status ? '\u2714' : '\u25FB',
29
+ };
30
+ return codeWindow.showQuickPick([on, off], {
31
+ placeHolder: translate('grayscale.toggle'),
32
+ ignoreFocusOut: false,
33
+ matchOnDescription: true,
34
+ });
35
+ };
36
+
37
+ /** Handle the actions from the QuickPick. */
38
+ const handleQuickPickActions = (value: QuickPickItem) => {
39
+ if (!value || !value.description) return;
40
+ switch (value.description) {
41
+ case translate('toggleSwitch.on'): {
42
+ return setThemeConfig('saturation', 0, true);
43
+ }
44
+ case translate('toggleSwitch.off'): {
45
+ return setThemeConfig('saturation', 1, true);
46
+ }
47
+ default:
48
+ return;
49
+ }
50
+ };
51
+
52
+ /** Is grayscale icons enabled? */
53
+ export const checkGrayscaleStatus = (): boolean => {
54
+ return getMaterialIconsJSON()?.options?.saturation === 0;
55
+ };