material-icon-theme 4.26.0 → 4.28.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.
Files changed (150) hide show
  1. package/dist/material-icons.json +5742 -0
  2. package/icons/file.svg +1 -0
  3. package/icons/folder-mojo-open.svg +2 -0
  4. package/icons/folder-mojo.svg +2 -0
  5. package/icons/folder-open.svg +1 -0
  6. package/icons/folder-root-open.svg +1 -0
  7. package/icons/folder-root.svg +1 -0
  8. package/icons/folder.svg +1 -0
  9. package/icons/ifanr-cloud.svg +10 -0
  10. package/icons/mermaid.svg +4 -0
  11. package/icons/mojo.svg +2 -0
  12. package/icons/qwik.svg +2 -0
  13. package/icons/unocss.svg +12 -0
  14. package/package.json +7 -1
  15. package/.eslintignore +0 -1
  16. package/.eslintrc.json +0 -51
  17. package/.github/FUNDING.yml +0 -3
  18. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -34
  19. package/.github/ISSUE_TEMPLATE/icon_request.md +0 -27
  20. package/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md +0 -7
  21. package/.github/workflows/build.yml +0 -45
  22. package/.github/workflows/color-check.yml +0 -22
  23. package/.github/workflows/release.yml +0 -73
  24. package/.prettierrc +0 -7
  25. package/.vscode/extensions.json +0 -3
  26. package/.vscode/launch.json +0 -43
  27. package/.vscode/settings.json +0 -14
  28. package/.vscode/tasks.json +0 -32
  29. package/.vscodeignore +0 -22
  30. package/CHANGELOG.md +0 -1343
  31. package/CONTRIBUTING.md +0 -232
  32. package/build/web-extension.webpack.config.js +0 -62
  33. package/build/webpack.config.js +0 -39
  34. package/changelog.config.json +0 -4
  35. package/images/commandPalette.png +0 -0
  36. package/images/contributors.png +0 -0
  37. package/images/fileIcons.png +0 -0
  38. package/images/folderIcons.png +0 -0
  39. package/images/how-tos/folder-icon-parts.png +0 -0
  40. package/images/how-tos/pick-folder-colors.png +0 -0
  41. package/images/how-tos/pick-folder-colors.svg +0 -301
  42. package/images/how-tos/svg-folder-icon-with-correct-colors.png +0 -0
  43. package/images/how-tos/svg-folder-icon-with-wrong-colors.png +0 -0
  44. package/images/how-tos/svg-with-light-color.png +0 -0
  45. package/images/how-tos/svg-with-spacing.png +0 -0
  46. package/images/how-tos/svg-with-too-dark-color.png +0 -0
  47. package/images/how-tos/svg-with-wrong-color.png +0 -0
  48. package/images/how-tos/svg-without-spacing.png +0 -0
  49. package/images/set-folder-color.gif +0 -0
  50. package/images/set-folder-theme.gif +0 -0
  51. package/logo.png +0 -0
  52. package/logo.svg +0 -21
  53. package/material-colors.yml +0 -257
  54. package/package.nls.de.json +0 -34
  55. package/package.nls.es.json +0 -29
  56. package/package.nls.fr.json +0 -29
  57. package/package.nls.ja.json +0 -32
  58. package/package.nls.json +0 -34
  59. package/package.nls.nl.json +0 -32
  60. package/package.nls.pl.json +0 -32
  61. package/package.nls.pt-BR.json +0 -29
  62. package/package.nls.pt-PT.json +0 -29
  63. package/package.nls.ru.json +0 -29
  64. package/package.nls.zh-CN.json +0 -29
  65. package/package.nls.zh-TW.json +0 -29
  66. package/src/commands/activate.ts +0 -28
  67. package/src/commands/explorerArrows.ts +0 -55
  68. package/src/commands/fileColor.ts +0 -96
  69. package/src/commands/folderColor.ts +0 -96
  70. package/src/commands/folders.ts +0 -55
  71. package/src/commands/grayscale.ts +0 -55
  72. package/src/commands/iconPacks.ts +0 -64
  73. package/src/commands/index.ts +0 -32
  74. package/src/commands/opacity.ts +0 -46
  75. package/src/commands/restoreConfig.ts +0 -15
  76. package/src/commands/saturation.ts +0 -46
  77. package/src/extension.ts +0 -37
  78. package/src/helpers/changeDetection.ts +0 -109
  79. package/src/helpers/customIcons.ts +0 -8
  80. package/src/helpers/fileConfig.ts +0 -38
  81. package/src/helpers/index.ts +0 -88
  82. package/src/helpers/objects.ts +0 -58
  83. package/src/helpers/types.ts +0 -7
  84. package/src/i18n/index.ts +0 -78
  85. package/src/i18n/lang-de.ts +0 -45
  86. package/src/i18n/lang-en.ts +0 -45
  87. package/src/i18n/lang-es.ts +0 -45
  88. package/src/i18n/lang-fr.ts +0 -45
  89. package/src/i18n/lang-ja.ts +0 -45
  90. package/src/i18n/lang-nl.ts +0 -45
  91. package/src/i18n/lang-pl.ts +0 -45
  92. package/src/i18n/lang-pt-br.ts +0 -45
  93. package/src/i18n/lang-pt-pt.ts +0 -45
  94. package/src/i18n/lang-ru.ts +0 -45
  95. package/src/i18n/lang-uk.ts +0 -45
  96. package/src/i18n/lang-zh-cn.ts +0 -45
  97. package/src/i18n/lang-zh-tw.ts +0 -45
  98. package/src/icons/fileIcons.ts +0 -2294
  99. package/src/icons/folderIcons.ts +0 -835
  100. package/src/icons/generator/constants.ts +0 -29
  101. package/src/icons/generator/fileGenerator.ts +0 -233
  102. package/src/icons/generator/folderGenerator.ts +0 -340
  103. package/src/icons/generator/iconOpacity.ts +0 -111
  104. package/src/icons/generator/iconSaturation.ts +0 -140
  105. package/src/icons/generator/index.ts +0 -7
  106. package/src/icons/generator/jsonGenerator.ts +0 -207
  107. package/src/icons/generator/languageGenerator.ts +0 -127
  108. package/src/icons/index.ts +0 -4
  109. package/src/icons/languageIcons.ts +0 -144
  110. package/src/models/i18n/index.ts +0 -1
  111. package/src/models/i18n/translation.ts +0 -43
  112. package/src/models/iconConfiguration.ts +0 -37
  113. package/src/models/icons/defaultIcon.ts +0 -16
  114. package/src/models/icons/files/fileIcon.ts +0 -49
  115. package/src/models/icons/files/fileTypes.ts +0 -14
  116. package/src/models/icons/files/index.ts +0 -2
  117. package/src/models/icons/folders/folderIcon.ts +0 -34
  118. package/src/models/icons/folders/folderTheme.ts +0 -23
  119. package/src/models/icons/folders/index.ts +0 -2
  120. package/src/models/icons/iconJsonOptions.ts +0 -22
  121. package/src/models/icons/iconPack.ts +0 -12
  122. package/src/models/icons/index.ts +0 -6
  123. package/src/models/icons/languages/index.ts +0 -1
  124. package/src/models/icons/languages/languageIdentifier.ts +0 -26
  125. package/src/models/index.ts +0 -3
  126. package/src/models/scripts/contributors/contributor.ts +0 -22
  127. package/src/models/scripts/contributors/contributorsConfig.ts +0 -10
  128. package/src/scripts/contributors/contributors.css +0 -24
  129. package/src/scripts/contributors/index.ts +0 -138
  130. package/src/scripts/helpers/painter.ts +0 -5
  131. package/src/scripts/helpers/screenshots.ts +0 -32
  132. package/src/scripts/helpers/similarity.ts +0 -47
  133. package/src/scripts/helpers/titleCase.ts +0 -7
  134. package/src/scripts/icons/checks/checkIconAvailability.ts +0 -215
  135. package/src/scripts/icons/checks/checkIconConflicts.ts +0 -152
  136. package/src/scripts/icons/checks/checkIconUsage.ts +0 -137
  137. package/src/scripts/icons/checks/index.ts +0 -7
  138. package/src/scripts/icons/generateJson.ts +0 -11
  139. package/src/scripts/preview/index.ts +0 -40
  140. package/src/scripts/preview/preview.ts +0 -163
  141. package/src/scripts/preview/style.css +0 -48
  142. package/src/test/runTest.ts +0 -26
  143. package/src/test/spec/i18n/i18n.spec.ts +0 -54
  144. package/src/test/spec/icons/fileIcons.spec.ts +0 -250
  145. package/src/test/spec/icons/folderIcons.spec.ts +0 -418
  146. package/src/test/spec/icons/languageIcons.spec.ts +0 -184
  147. package/src/test/spec/index.ts +0 -36
  148. package/src/web/extension.ts +0 -10
  149. package/svgo.config.js +0 -12
  150. package/tsconfig.json +0 -23
@@ -1,29 +0,0 @@
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,29 +0,0 @@
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 +0,0 @@
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 +0,0 @@
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 +0,0 @@
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 FileColor {
7
- label: string;
8
- hex: string;
9
- }
10
-
11
- const iconPalette: FileColor[] = [
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 file icons. */
23
- export const changeFileColor = async () => {
24
- try {
25
- const status = checkFileColorStatus();
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 file 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('colorSelect.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('colorSelect.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('colorSelect.wrongHexCode');
74
- }
75
- return undefined;
76
- };
77
-
78
- /** Check status of the file color */
79
- export const checkFileColorStatus = (): string => {
80
- const defaultOptions = getDefaultIconOptions();
81
- const config = getMaterialIconsJSON();
82
- return config?.options?.files?.color ?? defaultOptions.files.color!;
83
- };
84
-
85
- const setColorConfig = (value: string) => {
86
- setThemeConfig('files.color', value.toLowerCase(), true);
87
- };
88
-
89
- const isColorActive = (color: FileColor, 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,96 +0,0 @@
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('colorSelect.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('colorSelect.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('colorSelect.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 +0,0 @@
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 +0,0 @@
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,64 +0,0 @@
1
- import { QuickPickItem, window as codeWindow } from 'vscode';
2
- import { getMaterialIconsJSON, setThemeConfig, toTitleCase } from '../helpers';
3
- import { translate } from '../i18n';
4
- import { IconPack } from '../models';
5
-
6
- /** Command to toggle the icons packs */
7
- export const toggleIconPacks = async () => {
8
- try {
9
- const activeIconPack = getActiveIconPack();
10
- const response = await showQuickPickItems(activeIconPack);
11
- if (response) {
12
- handleQuickPickActions(response);
13
- }
14
- } catch (error) {
15
- console.error(error);
16
- }
17
- };
18
-
19
- /** Show QuickPick items to select preferred configuration for the icon packs. */
20
- const showQuickPickItems = (activePack: string) => {
21
- const packs = [...getAllIconPacks().sort(), 'none'];
22
- const options = packs.map((pack): QuickPickItem => {
23
- const packLabel = toTitleCase(pack.replace('_', ' + '));
24
- const active = isPackActive(activePack, pack);
25
- const iconPacksDeactivated = pack === 'none' && activePack === '';
26
-
27
- return {
28
- description: packLabel,
29
- detail: translate(
30
- `iconPacks.${pack === 'none' ? 'disabled' : 'description'}`,
31
- packLabel
32
- ),
33
- label: iconPacksDeactivated ? '\u2714' : active ? '\u2714' : '\u25FB',
34
- };
35
- });
36
-
37
- return codeWindow.showQuickPick(options, {
38
- placeHolder: translate('iconPacks.selectPack'),
39
- ignoreFocusOut: false,
40
- matchOnDescription: true,
41
- matchOnDetail: true,
42
- });
43
- };
44
-
45
- /** Handle the actions from the QuickPick. */
46
- const handleQuickPickActions = (value: QuickPickItem) => {
47
- if (!value || !value.description) return;
48
- const decision = value.description.replace(' + ', '_').toLowerCase();
49
-
50
- setThemeConfig('activeIconPack', decision === 'none' ? '' : decision, true);
51
- };
52
-
53
- const getActiveIconPack = (): string => {
54
- return getMaterialIconsJSON()?.options?.activeIconPack ?? '';
55
- };
56
-
57
- /** Get all packs that can be used in this icon theme. */
58
- export const getAllIconPacks = (): string[] => {
59
- return Object.values(IconPack).map((p) => p.toLowerCase());
60
- };
61
-
62
- const isPackActive = (activePack: string, pack: string) => {
63
- return activePack.toLowerCase() === pack.toLowerCase();
64
- };
@@ -1,32 +0,0 @@
1
- import { commands } from 'vscode';
2
- import { activateIcons } from './activate';
3
- import { toggleExplorerArrows } from './explorerArrows';
4
- import { changeFileColor } from './fileColor';
5
- import { changeFolderColor } from './folderColor';
6
- import { changeFolderTheme } from './folders';
7
- import { toggleGrayscale } from './grayscale';
8
- import { toggleIconPacks } from './iconPacks';
9
- import { changeOpacity } from './opacity';
10
- import { restoreDefaultConfig } from './restoreConfig';
11
- import { changeSaturation } from './saturation';
12
-
13
- const extensionCommands: { [commmand: string]: () => Promise<void> } = {
14
- activateIcons,
15
- toggleIconPacks,
16
- changeFolderTheme,
17
- changeFolderColor,
18
- changeFileColor,
19
- restoreDefaultConfig,
20
- toggleExplorerArrows,
21
- changeOpacity,
22
- toggleGrayscale,
23
- changeSaturation,
24
- };
25
-
26
- export const registered = Object.keys(extensionCommands).map((commandName) => {
27
- const callCommand = () => extensionCommands[commandName]();
28
- return commands.registerCommand(
29
- `material-icon-theme.${commandName}`,
30
- callCommand
31
- );
32
- });
@@ -1,46 +0,0 @@
1
- import { window as codeWindow } from 'vscode';
2
- import { getMaterialIconsJSON, setThemeConfig } from '../helpers';
3
- import { translate } from '../i18n';
4
- import { getDefaultIconOptions, validateOpacityValue } from '../icons';
5
-
6
- /** Command to toggle the folder icons. */
7
- export const changeOpacity = async () => {
8
- try {
9
- const currentOpacityValue = getCurrentOpacityValue();
10
- const response = await showInput(currentOpacityValue);
11
- if (response) {
12
- await setOpacityConfig(+response);
13
- }
14
- } catch (error) {
15
- console.error(error);
16
- }
17
- };
18
-
19
- /** Show input to enter the opacity value. */
20
- const showInput = (opacity: number) => {
21
- return codeWindow.showInputBox({
22
- placeHolder: translate('opacity.inputPlaceholder'),
23
- ignoreFocusOut: true,
24
- value: opacity.toString(),
25
- validateInput: validateOpacityInput,
26
- });
27
- };
28
-
29
- /** Validate the opacity value which was inserted by the user. */
30
- const validateOpacityInput = (opacityInput: string) => {
31
- if (!validateOpacityValue(+opacityInput)) {
32
- return translate('opacity.wrongValue');
33
- }
34
- return undefined;
35
- };
36
-
37
- /** Get the current value of the opacity of the icons. */
38
- export const getCurrentOpacityValue = (): number => {
39
- const defaultOptions = getDefaultIconOptions();
40
- const config = getMaterialIconsJSON();
41
- return config?.options?.opacity ?? defaultOptions.opacity;
42
- };
43
-
44
- const setOpacityConfig = (opacity: number) => {
45
- return setThemeConfig('opacity', opacity, true);
46
- };
@@ -1,15 +0,0 @@
1
- import { setThemeConfig } from './../helpers';
2
-
3
- /** Restore all configurations to default. */
4
- export const restoreDefaultConfig = async () => {
5
- await setThemeConfig('activeIconPack', undefined, true);
6
- await setThemeConfig('folders.theme', undefined, true);
7
- await setThemeConfig('folders.color', undefined, true);
8
- await setThemeConfig('files.color', undefined, true);
9
- await setThemeConfig('hidesExplorerArrows', undefined, true);
10
- await setThemeConfig('opacity', undefined, true);
11
- await setThemeConfig('saturation', undefined, true);
12
- await setThemeConfig('files.associations', undefined, true);
13
- await setThemeConfig('folders.associations', undefined, true);
14
- await setThemeConfig('languages.associations', undefined, true);
15
- };
@@ -1,46 +0,0 @@
1
- import { window as codeWindow } from 'vscode';
2
- import { getMaterialIconsJSON, setThemeConfig } from '../helpers';
3
- import { translate } from '../i18n';
4
- import { getDefaultIconOptions, validateSaturationValue } from '../icons';
5
-
6
- /** Command to toggle the folder icons. */
7
- export const changeSaturation = async () => {
8
- try {
9
- const currentSaturationValue = getCurrentSaturationValue();
10
- const response = await showInput(currentSaturationValue);
11
- if (response) {
12
- await setSaturationConfig(+response);
13
- }
14
- } catch (error) {
15
- console.error(error);
16
- }
17
- };
18
-
19
- /** Show input to enter the saturation value. */
20
- const showInput = (saturation: number) => {
21
- return codeWindow.showInputBox({
22
- placeHolder: translate('saturation.inputPlaceholder'),
23
- ignoreFocusOut: true,
24
- value: saturation.toString(),
25
- validateInput: validateSaturationInput,
26
- });
27
- };
28
-
29
- /** Validate the saturation value which was inserted by the user. */
30
- const validateSaturationInput = (saturationInput: string) => {
31
- if (!validateSaturationValue(+saturationInput)) {
32
- return translate('saturation.wrongValue');
33
- }
34
- return undefined;
35
- };
36
-
37
- /** Get the current value of the saturation of the icons. */
38
- export const getCurrentSaturationValue = (): number => {
39
- const defaultOptions = getDefaultIconOptions();
40
- const config = getMaterialIconsJSON();
41
- return config?.options?.saturation ?? defaultOptions.saturation;
42
- };
43
-
44
- const setSaturationConfig = (saturation: number) => {
45
- return setThemeConfig('saturation', saturation, true);
46
- };