material-icon-theme 4.23.1 → 4.25.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 (108) hide show
  1. package/.eslintrc.json +51 -51
  2. package/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md +7 -0
  3. package/.github/workflows/build.yml +45 -45
  4. package/.github/workflows/color-check.yml +22 -22
  5. package/.github/workflows/release.yml +73 -73
  6. package/.vscodeignore +21 -21
  7. package/CHANGELOG.md +1325 -1292
  8. package/CONTRIBUTING.md +199 -29
  9. package/README.md +198 -199
  10. package/icons/bitbucket.svg +13 -1
  11. package/icons/bun.svg +2 -0
  12. package/icons/bun_light.svg +2 -0
  13. package/icons/craco.svg +45 -45
  14. package/icons/folder-changesets-open.svg +5 -5
  15. package/icons/folder-changesets.svg +2 -2
  16. package/icons/folder-decorators-open.svg +2 -2
  17. package/icons/folder-decorators.svg +5 -5
  18. package/icons/folder-gamemaker-open.svg +2 -0
  19. package/icons/folder-gamemaker.svg +2 -0
  20. package/icons/folder-supabase-open.svg +5 -5
  21. package/icons/folder-supabase.svg +2 -2
  22. package/icons/gamemaker.svg +4 -0
  23. package/icons/objective-c.svg +1 -0
  24. package/icons/objective-cpp.svg +1 -0
  25. package/icons/pascal.svg +6 -1
  26. package/icons/sonarcloud.svg +4 -4
  27. package/icons/stylable.svg +10 -10
  28. package/icons/supabase.svg +4 -4
  29. package/icons/tldraw.svg +4 -0
  30. package/icons/tldraw_light.svg +4 -0
  31. package/icons/vitest.svg +6 -6
  32. package/images/contributors.png +0 -0
  33. package/images/fileIcons.png +0 -0
  34. package/images/folderIcons.png +0 -0
  35. package/images/how-tos/folder-icon-parts.png +0 -0
  36. package/images/how-tos/pick-folder-colors.png +0 -0
  37. package/images/how-tos/pick-folder-colors.svg +301 -0
  38. package/images/how-tos/svg-folder-icon-with-correct-colors.png +0 -0
  39. package/images/how-tos/svg-folder-icon-with-wrong-colors.png +0 -0
  40. package/images/how-tos/svg-with-light-color.png +0 -0
  41. package/images/how-tos/svg-with-spacing.png +0 -0
  42. package/images/how-tos/svg-with-too-dark-color.png +0 -0
  43. package/images/how-tos/svg-with-wrong-color.png +0 -0
  44. package/images/how-tos/svg-without-spacing.png +0 -0
  45. package/package.json +252 -252
  46. package/package.nls.de.json +32 -32
  47. package/package.nls.es.json +29 -29
  48. package/package.nls.fr.json +29 -29
  49. package/package.nls.ja.json +32 -32
  50. package/package.nls.json +32 -32
  51. package/package.nls.nl.json +32 -32
  52. package/package.nls.pl.json +32 -32
  53. package/package.nls.pt-BR.json +29 -29
  54. package/package.nls.pt-PT.json +29 -29
  55. package/package.nls.ru.json +29 -29
  56. package/package.nls.zh-CN.json +29 -29
  57. package/package.nls.zh-TW.json +29 -29
  58. package/src/commands/activate.ts +28 -28
  59. package/src/commands/explorerArrows.ts +55 -55
  60. package/src/commands/folderColor.ts +96 -96
  61. package/src/commands/folders.ts +55 -55
  62. package/src/commands/grayscale.ts +55 -55
  63. package/src/commands/iconPacks.ts +64 -64
  64. package/src/commands/index.ts +30 -30
  65. package/src/commands/opacity.ts +46 -46
  66. package/src/commands/saturation.ts +46 -46
  67. package/src/extension.ts +37 -37
  68. package/src/helpers/customIcons.ts +8 -8
  69. package/src/helpers/index.ts +88 -88
  70. package/src/i18n/index.ts +78 -78
  71. package/src/i18n/lang-de.ts +43 -43
  72. package/src/i18n/lang-en.ts +43 -43
  73. package/src/i18n/lang-es.ts +43 -43
  74. package/src/i18n/lang-fr.ts +43 -43
  75. package/src/i18n/lang-ja.ts +43 -43
  76. package/src/i18n/lang-nl.ts +43 -43
  77. package/src/i18n/lang-pl.ts +43 -43
  78. package/src/i18n/lang-pt-br.ts +43 -43
  79. package/src/i18n/lang-pt-pt.ts +43 -43
  80. package/src/i18n/lang-ru.ts +43 -43
  81. package/src/i18n/lang-uk.ts +43 -43
  82. package/src/i18n/lang-zh-cn.ts +43 -43
  83. package/src/i18n/lang-zh-tw.ts +43 -43
  84. package/src/icons/fileIcons.ts +2240 -2197
  85. package/src/icons/folderIcons.ts +823 -806
  86. package/src/icons/generator/folderGenerator.ts +340 -340
  87. package/src/icons/generator/iconOpacity.ts +111 -111
  88. package/src/icons/generator/iconSaturation.ts +140 -140
  89. package/src/icons/generator/jsonGenerator.ts +191 -191
  90. package/src/icons/languageIcons.ts +144 -141
  91. package/src/models/i18n/translation.ts +41 -41
  92. package/src/models/iconConfiguration.ts +37 -37
  93. package/src/models/icons/iconJsonOptions.ts +21 -21
  94. package/src/models/index.ts +3 -3
  95. package/src/scripts/contributors/index.ts +138 -138
  96. package/src/scripts/helpers/screenshots.ts +32 -32
  97. package/src/scripts/icons/checks/checkIconAvailability.ts +215 -215
  98. package/src/scripts/icons/checks/checkIconConflicts.ts +152 -152
  99. package/src/scripts/icons/checks/checkIconUsage.ts +137 -137
  100. package/src/scripts/icons/checks/index.ts +7 -7
  101. package/src/scripts/preview/index.ts +40 -40
  102. package/src/scripts/preview/preview.ts +163 -163
  103. package/src/test/runTest.ts +26 -26
  104. package/src/test/spec/i18n/i18n.spec.ts +54 -54
  105. package/src/test/spec/icons/fileIcons.spec.ts +250 -250
  106. package/src/test/spec/icons/folderIcons.spec.ts +418 -418
  107. package/src/test/spec/icons/languageIcons.spec.ts +184 -184
  108. package/images/bloop.png +0 -0
@@ -1,215 +1,215 @@
1
- import { readdir } from 'fs';
2
- import { join, parse } from 'path';
3
- import {
4
- DefaultIcon,
5
- FileIcon,
6
- FolderIcon,
7
- FolderTheme,
8
- } from '../../../models/index';
9
- import { green, red } from '../../helpers/painter';
10
- import { similarity } from '../../helpers/similarity';
11
- import {
12
- fileIcons,
13
- folderIcons,
14
- highContrastColorFileEnding,
15
- languageIcons,
16
- lightColorFileEnding,
17
- openedFolder,
18
- } from './../../../icons';
19
-
20
- /**
21
- * Defines the folder where all icon files are located.
22
- */
23
- const folderPath = join('icons');
24
-
25
- /**
26
- * Defines an array with all icons that can be found in the file system.
27
- */
28
- const availableIcons: Record<string, string> = {};
29
-
30
- /**
31
- * Save the misconfigured icons.
32
- */
33
- const wrongIconNames: Record<string, string[]> = {
34
- fileIcons: [],
35
- folderIcons: [],
36
- languageIcons: [],
37
- };
38
-
39
- /**
40
- * Get all icon file names from the file system.
41
- */
42
- const fsReadAllIconFiles = (
43
- err: NodeJS.ErrnoException | null,
44
- files: string[]
45
- ) => {
46
- if (err) {
47
- throw Error(err.message);
48
- }
49
-
50
- files.forEach((file) => {
51
- const fileName = file;
52
- const iconName = parse(file).name;
53
- availableIcons[iconName] = fileName;
54
- });
55
-
56
- // check icon configurations
57
- checkFileIcons();
58
- checkFolderIcons();
59
- checkLanguageIcons();
60
-
61
- // show error messages
62
- handleErrors();
63
- };
64
-
65
- // read from the file system
66
- export const check = () => readdir(folderPath, fsReadAllIconFiles);
67
-
68
- /**
69
- * Check if the file icons from the configuration are available on the file system.
70
- */
71
- const checkFileIcons = () => {
72
- [...fileIcons.icons, fileIcons.defaultIcon].forEach((icon) => {
73
- isIconAvailable(icon, IconType.fileIcons, IconColor.default);
74
- isIconAvailable(icon, IconType.fileIcons, IconColor.light);
75
- isIconAvailable(icon, IconType.fileIcons, IconColor.highContrast);
76
- });
77
- };
78
-
79
- const isIconAvailable = (
80
- icon: FileIcon | FolderIcon | DefaultIcon,
81
- iconType: IconType,
82
- iconColor: IconColor,
83
- hasOpenedFolder?: boolean
84
- ) => {
85
- let iconName = `${icon.name}${hasOpenedFolder ? openedFolder : ''}`;
86
- if (icon.light && iconColor === IconColor.light) {
87
- iconName += lightColorFileEnding;
88
- }
89
- if (icon.highContrast && iconColor === IconColor.highContrast) {
90
- iconName += highContrastColorFileEnding;
91
- }
92
-
93
- if (
94
- !availableIcons[iconName] &&
95
- wrongIconNames[iconType].indexOf(iconName) === -1
96
- ) {
97
- wrongIconNames[iconType].push(iconName);
98
- }
99
- };
100
-
101
- /**
102
- * Check if the folder icons from the configuration are available on the file system.
103
- */
104
- const checkFolderIcons = () => {
105
- folderIcons
106
- .map((theme) => (theme.name === 'none' ? [] : getAllFolderIcons(theme)))
107
- .reduce((a, b) => a.concat(b))
108
- .forEach((icon) => {
109
- if (icon) {
110
- isIconAvailable(icon, IconType.folderIcons, IconColor.default);
111
- isIconAvailable(icon, IconType.folderIcons, IconColor.default, true);
112
- isIconAvailable(icon, IconType.folderIcons, IconColor.light);
113
- isIconAvailable(icon, IconType.folderIcons, IconColor.light, true);
114
- isIconAvailable(icon, IconType.folderIcons, IconColor.highContrast);
115
- isIconAvailable(
116
- icon,
117
- IconType.folderIcons,
118
- IconColor.highContrast,
119
- true
120
- );
121
- }
122
- });
123
- };
124
-
125
- const getAllFolderIcons = (theme: FolderTheme) => {
126
- const icons = theme.icons ? theme.icons : [];
127
- return [theme.defaultIcon, theme.rootFolder, ...icons].filter(
128
- (icon) => icon !== undefined
129
- ); // filter undefined root folder icons
130
- };
131
-
132
- /**
133
- * Check if the language icons from the configuration are available on the file system.
134
- */
135
- const checkLanguageIcons = () => {
136
- languageIcons.forEach((lang) => {
137
- const icon = lang.icon;
138
- isIconAvailable(icon, IconType.languageIcons, IconColor.default);
139
- isIconAvailable(icon, IconType.languageIcons, IconColor.light);
140
- isIconAvailable(icon, IconType.languageIcons, IconColor.highContrast);
141
- });
142
- };
143
-
144
- /**
145
- * Show error messages in the terminal.
146
- */
147
- const handleErrors = () => {
148
- const amountOfErrors =
149
- wrongIconNames.fileIcons.length +
150
- wrongIconNames.folderIcons.length +
151
- wrongIconNames.languageIcons.length;
152
- if (amountOfErrors > 0) {
153
- console.log(
154
- '> Material Icon Theme:',
155
- red(`Found ${amountOfErrors} error(s) in the icon configuration!`)
156
- );
157
- } else {
158
- console.log(
159
- '> Material Icon Theme:',
160
- green('Passed icon availability checks!')
161
- );
162
- }
163
- logIconInformation(wrongIconNames.fileIcons, 'File icons');
164
- logIconInformation(wrongIconNames.folderIcons, 'Folder icons');
165
- logIconInformation(wrongIconNames.languageIcons, 'Language icons');
166
-
167
- if (amountOfErrors > 0) {
168
- throw new Error(
169
- 'Found some wrong file definitions in the icon configuration.'
170
- );
171
- }
172
- };
173
-
174
- const logIconInformation = (wrongIcons: string[], title: string) => {
175
- if (wrongIcons.length === 0) return;
176
- console.log(`\n${title}:\n--------------------------------`);
177
- wrongIcons.forEach((icon) => {
178
- const suggestion = Object.keys(availableIcons).find((i) => {
179
- return similarity(icon, i) > 0.75;
180
- });
181
- const suggestionString = suggestion
182
- ? ` (Did you mean ${green(suggestion)}?)`
183
- : '';
184
- const isWrongLightVersion = icon.endsWith(lightColorFileEnding);
185
- const isWrongLightVersionString = isWrongLightVersion
186
- ? ` (There is no light icon for ${green(
187
- icon.slice(0, -6)
188
- )}! Set the light option to false!)`
189
- : '';
190
- const isWrongHighContrastVersion = icon.endsWith(
191
- highContrastColorFileEnding
192
- );
193
- const isWrongHighContrastVersionString = isWrongHighContrastVersion
194
- ? ` (There is no high contrast icon for ${green(
195
- icon.slice(0, -13)
196
- )}! Set the highContrast option to false!)`
197
- : '';
198
- console.log(
199
- red(`Icon not found: ${icon}.svg`) +
200
- `${suggestionString}${isWrongLightVersionString}${isWrongHighContrastVersionString}`
201
- );
202
- });
203
- };
204
-
205
- enum IconType {
206
- fileIcons = 'fileIcons',
207
- folderIcons = 'folderIcons',
208
- languageIcons = 'languageIcons',
209
- }
210
-
211
- enum IconColor {
212
- default = 'default',
213
- light = 'light',
214
- highContrast = 'highContrast',
215
- }
1
+ import { readdir } from 'fs';
2
+ import { join, parse } from 'path';
3
+ import {
4
+ DefaultIcon,
5
+ FileIcon,
6
+ FolderIcon,
7
+ FolderTheme,
8
+ } from '../../../models/index';
9
+ import { green, red } from '../../helpers/painter';
10
+ import { similarity } from '../../helpers/similarity';
11
+ import {
12
+ fileIcons,
13
+ folderIcons,
14
+ highContrastColorFileEnding,
15
+ languageIcons,
16
+ lightColorFileEnding,
17
+ openedFolder,
18
+ } from './../../../icons';
19
+
20
+ /**
21
+ * Defines the folder where all icon files are located.
22
+ */
23
+ const folderPath = join('icons');
24
+
25
+ /**
26
+ * Defines an array with all icons that can be found in the file system.
27
+ */
28
+ const availableIcons: Record<string, string> = {};
29
+
30
+ /**
31
+ * Save the misconfigured icons.
32
+ */
33
+ const wrongIconNames: Record<string, string[]> = {
34
+ fileIcons: [],
35
+ folderIcons: [],
36
+ languageIcons: [],
37
+ };
38
+
39
+ /**
40
+ * Get all icon file names from the file system.
41
+ */
42
+ const fsReadAllIconFiles = (
43
+ err: NodeJS.ErrnoException | null,
44
+ files: string[]
45
+ ) => {
46
+ if (err) {
47
+ throw Error(err.message);
48
+ }
49
+
50
+ files.forEach((file) => {
51
+ const fileName = file;
52
+ const iconName = parse(file).name;
53
+ availableIcons[iconName] = fileName;
54
+ });
55
+
56
+ // check icon configurations
57
+ checkFileIcons();
58
+ checkFolderIcons();
59
+ checkLanguageIcons();
60
+
61
+ // show error messages
62
+ handleErrors();
63
+ };
64
+
65
+ // read from the file system
66
+ export const check = () => readdir(folderPath, fsReadAllIconFiles);
67
+
68
+ /**
69
+ * Check if the file icons from the configuration are available on the file system.
70
+ */
71
+ const checkFileIcons = () => {
72
+ [...fileIcons.icons, fileIcons.defaultIcon].forEach((icon) => {
73
+ isIconAvailable(icon, IconType.fileIcons, IconColor.default);
74
+ isIconAvailable(icon, IconType.fileIcons, IconColor.light);
75
+ isIconAvailable(icon, IconType.fileIcons, IconColor.highContrast);
76
+ });
77
+ };
78
+
79
+ const isIconAvailable = (
80
+ icon: FileIcon | FolderIcon | DefaultIcon,
81
+ iconType: IconType,
82
+ iconColor: IconColor,
83
+ hasOpenedFolder?: boolean
84
+ ) => {
85
+ let iconName = `${icon.name}${hasOpenedFolder ? openedFolder : ''}`;
86
+ if (icon.light && iconColor === IconColor.light) {
87
+ iconName += lightColorFileEnding;
88
+ }
89
+ if (icon.highContrast && iconColor === IconColor.highContrast) {
90
+ iconName += highContrastColorFileEnding;
91
+ }
92
+
93
+ if (
94
+ !availableIcons[iconName] &&
95
+ wrongIconNames[iconType].indexOf(iconName) === -1
96
+ ) {
97
+ wrongIconNames[iconType].push(iconName);
98
+ }
99
+ };
100
+
101
+ /**
102
+ * Check if the folder icons from the configuration are available on the file system.
103
+ */
104
+ const checkFolderIcons = () => {
105
+ folderIcons
106
+ .map((theme) => (theme.name === 'none' ? [] : getAllFolderIcons(theme)))
107
+ .reduce((a, b) => a.concat(b))
108
+ .forEach((icon) => {
109
+ if (icon) {
110
+ isIconAvailable(icon, IconType.folderIcons, IconColor.default);
111
+ isIconAvailable(icon, IconType.folderIcons, IconColor.default, true);
112
+ isIconAvailable(icon, IconType.folderIcons, IconColor.light);
113
+ isIconAvailable(icon, IconType.folderIcons, IconColor.light, true);
114
+ isIconAvailable(icon, IconType.folderIcons, IconColor.highContrast);
115
+ isIconAvailable(
116
+ icon,
117
+ IconType.folderIcons,
118
+ IconColor.highContrast,
119
+ true
120
+ );
121
+ }
122
+ });
123
+ };
124
+
125
+ const getAllFolderIcons = (theme: FolderTheme) => {
126
+ const icons = theme.icons ? theme.icons : [];
127
+ return [theme.defaultIcon, theme.rootFolder, ...icons].filter(
128
+ (icon) => icon !== undefined
129
+ ); // filter undefined root folder icons
130
+ };
131
+
132
+ /**
133
+ * Check if the language icons from the configuration are available on the file system.
134
+ */
135
+ const checkLanguageIcons = () => {
136
+ languageIcons.forEach((lang) => {
137
+ const icon = lang.icon;
138
+ isIconAvailable(icon, IconType.languageIcons, IconColor.default);
139
+ isIconAvailable(icon, IconType.languageIcons, IconColor.light);
140
+ isIconAvailable(icon, IconType.languageIcons, IconColor.highContrast);
141
+ });
142
+ };
143
+
144
+ /**
145
+ * Show error messages in the terminal.
146
+ */
147
+ const handleErrors = () => {
148
+ const amountOfErrors =
149
+ wrongIconNames.fileIcons.length +
150
+ wrongIconNames.folderIcons.length +
151
+ wrongIconNames.languageIcons.length;
152
+ if (amountOfErrors > 0) {
153
+ console.log(
154
+ '> Material Icon Theme:',
155
+ red(`Found ${amountOfErrors} error(s) in the icon configuration!`)
156
+ );
157
+ } else {
158
+ console.log(
159
+ '> Material Icon Theme:',
160
+ green('Passed icon availability checks!')
161
+ );
162
+ }
163
+ logIconInformation(wrongIconNames.fileIcons, 'File icons');
164
+ logIconInformation(wrongIconNames.folderIcons, 'Folder icons');
165
+ logIconInformation(wrongIconNames.languageIcons, 'Language icons');
166
+
167
+ if (amountOfErrors > 0) {
168
+ throw new Error(
169
+ 'Found some wrong file definitions in the icon configuration.'
170
+ );
171
+ }
172
+ };
173
+
174
+ const logIconInformation = (wrongIcons: string[], title: string) => {
175
+ if (wrongIcons.length === 0) return;
176
+ console.log(`\n${title}:\n--------------------------------`);
177
+ wrongIcons.forEach((icon) => {
178
+ const suggestion = Object.keys(availableIcons).find((i) => {
179
+ return similarity(icon, i) > 0.75;
180
+ });
181
+ const suggestionString = suggestion
182
+ ? ` (Did you mean ${green(suggestion)}?)`
183
+ : '';
184
+ const isWrongLightVersion = icon.endsWith(lightColorFileEnding);
185
+ const isWrongLightVersionString = isWrongLightVersion
186
+ ? ` (There is no light icon for ${green(
187
+ icon.slice(0, -6)
188
+ )}! Set the light option to false!)`
189
+ : '';
190
+ const isWrongHighContrastVersion = icon.endsWith(
191
+ highContrastColorFileEnding
192
+ );
193
+ const isWrongHighContrastVersionString = isWrongHighContrastVersion
194
+ ? ` (There is no high contrast icon for ${green(
195
+ icon.slice(0, -13)
196
+ )}! Set the highContrast option to false!)`
197
+ : '';
198
+ console.log(
199
+ red(`Icon not found: ${icon}.svg`) +
200
+ `${suggestionString}${isWrongLightVersionString}${isWrongHighContrastVersionString}`
201
+ );
202
+ });
203
+ };
204
+
205
+ enum IconType {
206
+ fileIcons = 'fileIcons',
207
+ folderIcons = 'folderIcons',
208
+ languageIcons = 'languageIcons',
209
+ }
210
+
211
+ enum IconColor {
212
+ default = 'default',
213
+ light = 'light',
214
+ highContrast = 'highContrast',
215
+ }