material-icon-theme 4.25.0 → 4.27.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/README.md +5 -4
- package/dist/material-icons.json +5704 -0
- package/icons/c.svg +4 -1
- package/icons/cpp.svg +4 -1
- package/icons/csharp.svg +4 -1
- package/icons/deno.svg +1 -0
- package/icons/deno_light.svg +1 -0
- package/icons/file.svg +1 -1
- package/icons/folder-godot-open.svg +2 -0
- package/icons/folder-godot.svg +8 -0
- package/icons/folder-mercurial-open.svg +5 -0
- package/icons/folder-mercurial.svg +2 -0
- package/icons/folder-netlify-open.svg +5 -1
- package/icons/folder-netlify.svg +2 -1
- package/icons/folder-open.svg +1 -0
- package/icons/folder-plastic-open.svg +8 -0
- package/icons/folder-plastic.svg +2 -0
- package/icons/folder-root-open.svg +1 -0
- package/icons/folder-root.svg +1 -0
- package/icons/folder.svg +1 -0
- package/icons/godot-assets.svg +7 -1
- package/icons/godot.svg +7 -1
- package/icons/ifanr-cloud.svg +10 -0
- package/icons/mercurial.svg +6 -0
- package/icons/mermaid.svg +4 -0
- package/icons/netlify.svg +7 -1
- package/icons/netlify_light.svg +7 -0
- package/icons/objective-c.svg +4 -1
- package/icons/plastic.svg +7 -0
- package/icons/qwik.svg +2 -0
- package/icons/rc.svg +2 -0
- package/icons/typst.svg +2 -0
- package/package.json +18 -1
- package/.eslintignore +0 -1
- package/.eslintrc.json +0 -51
- package/.github/FUNDING.yml +0 -3
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -34
- package/.github/ISSUE_TEMPLATE/icon_request.md +0 -27
- package/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md +0 -7
- package/.github/workflows/build.yml +0 -45
- package/.github/workflows/color-check.yml +0 -22
- package/.github/workflows/release.yml +0 -73
- package/.prettierrc +0 -7
- package/.vscode/extensions.json +0 -3
- package/.vscode/launch.json +0 -43
- package/.vscode/settings.json +0 -14
- package/.vscode/tasks.json +0 -32
- package/.vscodeignore +0 -22
- package/CHANGELOG.md +0 -1325
- package/CONTRIBUTING.md +0 -232
- package/build/web-extension.webpack.config.js +0 -62
- package/build/webpack.config.js +0 -39
- package/changelog.config.json +0 -4
- package/images/commandPalette.png +0 -0
- package/images/contributors.png +0 -0
- package/images/fileIcons.png +0 -0
- package/images/folderIcons.png +0 -0
- package/images/how-tos/folder-icon-parts.png +0 -0
- package/images/how-tos/pick-folder-colors.png +0 -0
- package/images/how-tos/pick-folder-colors.svg +0 -301
- package/images/how-tos/svg-folder-icon-with-correct-colors.png +0 -0
- package/images/how-tos/svg-folder-icon-with-wrong-colors.png +0 -0
- package/images/how-tos/svg-with-light-color.png +0 -0
- package/images/how-tos/svg-with-spacing.png +0 -0
- package/images/how-tos/svg-with-too-dark-color.png +0 -0
- package/images/how-tos/svg-with-wrong-color.png +0 -0
- package/images/how-tos/svg-without-spacing.png +0 -0
- package/images/set-folder-color.gif +0 -0
- package/images/set-folder-theme.gif +0 -0
- package/images/stepsize.png +0 -0
- package/logo.png +0 -0
- package/logo.svg +0 -21
- package/material-colors.yml +0 -257
- package/package.nls.de.json +0 -32
- package/package.nls.es.json +0 -29
- package/package.nls.fr.json +0 -29
- package/package.nls.ja.json +0 -32
- package/package.nls.json +0 -32
- package/package.nls.nl.json +0 -32
- package/package.nls.pl.json +0 -32
- package/package.nls.pt-BR.json +0 -29
- package/package.nls.pt-PT.json +0 -29
- package/package.nls.ru.json +0 -29
- package/package.nls.zh-CN.json +0 -29
- package/package.nls.zh-TW.json +0 -29
- package/src/commands/activate.ts +0 -28
- package/src/commands/explorerArrows.ts +0 -55
- package/src/commands/folderColor.ts +0 -96
- package/src/commands/folders.ts +0 -55
- package/src/commands/grayscale.ts +0 -55
- package/src/commands/iconPacks.ts +0 -64
- package/src/commands/index.ts +0 -30
- package/src/commands/opacity.ts +0 -46
- package/src/commands/restoreConfig.ts +0 -14
- package/src/commands/saturation.ts +0 -46
- package/src/extension.ts +0 -37
- package/src/helpers/changeDetection.ts +0 -109
- package/src/helpers/customIcons.ts +0 -8
- package/src/helpers/fileConfig.ts +0 -37
- package/src/helpers/index.ts +0 -88
- package/src/helpers/objects.ts +0 -58
- package/src/helpers/types.ts +0 -7
- package/src/i18n/index.ts +0 -78
- package/src/i18n/lang-de.ts +0 -43
- package/src/i18n/lang-en.ts +0 -43
- package/src/i18n/lang-es.ts +0 -43
- package/src/i18n/lang-fr.ts +0 -43
- package/src/i18n/lang-ja.ts +0 -43
- package/src/i18n/lang-nl.ts +0 -43
- package/src/i18n/lang-pl.ts +0 -43
- package/src/i18n/lang-pt-br.ts +0 -43
- package/src/i18n/lang-pt-pt.ts +0 -43
- package/src/i18n/lang-ru.ts +0 -43
- package/src/i18n/lang-uk.ts +0 -43
- package/src/i18n/lang-zh-cn.ts +0 -43
- package/src/i18n/lang-zh-tw.ts +0 -43
- package/src/icons/fileIcons.ts +0 -2240
- package/src/icons/folderIcons.ts +0 -823
- package/src/icons/generator/constants.ts +0 -29
- package/src/icons/generator/fileGenerator.ts +0 -216
- package/src/icons/generator/folderGenerator.ts +0 -340
- package/src/icons/generator/iconOpacity.ts +0 -111
- package/src/icons/generator/iconSaturation.ts +0 -140
- package/src/icons/generator/index.ts +0 -7
- package/src/icons/generator/jsonGenerator.ts +0 -191
- package/src/icons/generator/languageGenerator.ts +0 -127
- package/src/icons/index.ts +0 -4
- package/src/icons/languageIcons.ts +0 -144
- package/src/models/i18n/index.ts +0 -1
- package/src/models/i18n/translation.ts +0 -41
- package/src/models/iconConfiguration.ts +0 -37
- package/src/models/icons/defaultIcon.ts +0 -16
- package/src/models/icons/files/fileIcon.ts +0 -49
- package/src/models/icons/files/fileTypes.ts +0 -14
- package/src/models/icons/files/index.ts +0 -2
- package/src/models/icons/folders/folderIcon.ts +0 -34
- package/src/models/icons/folders/folderTheme.ts +0 -23
- package/src/models/icons/folders/index.ts +0 -2
- package/src/models/icons/iconJsonOptions.ts +0 -21
- package/src/models/icons/iconPack.ts +0 -12
- package/src/models/icons/index.ts +0 -6
- package/src/models/icons/languages/index.ts +0 -1
- package/src/models/icons/languages/languageIdentifier.ts +0 -26
- package/src/models/index.ts +0 -3
- package/src/models/scripts/contributors/contributor.ts +0 -22
- package/src/models/scripts/contributors/contributorsConfig.ts +0 -10
- package/src/scripts/contributors/contributors.css +0 -24
- package/src/scripts/contributors/index.ts +0 -138
- package/src/scripts/helpers/painter.ts +0 -5
- package/src/scripts/helpers/screenshots.ts +0 -32
- package/src/scripts/helpers/similarity.ts +0 -47
- package/src/scripts/helpers/titleCase.ts +0 -7
- package/src/scripts/icons/checks/checkIconAvailability.ts +0 -215
- package/src/scripts/icons/checks/checkIconConflicts.ts +0 -152
- package/src/scripts/icons/checks/checkIconUsage.ts +0 -137
- package/src/scripts/icons/checks/index.ts +0 -7
- package/src/scripts/icons/generateJson.ts +0 -11
- package/src/scripts/preview/index.ts +0 -40
- package/src/scripts/preview/preview.ts +0 -163
- package/src/scripts/preview/style.css +0 -48
- package/src/test/runTest.ts +0 -26
- package/src/test/spec/i18n/i18n.spec.ts +0 -54
- package/src/test/spec/icons/fileIcons.spec.ts +0 -250
- package/src/test/spec/icons/folderIcons.spec.ts +0 -418
- package/src/test/spec/icons/languageIcons.spec.ts +0 -184
- package/src/test/spec/index.ts +0 -36
- package/src/web/extension.ts +0 -10
- package/svgo.config.js +0 -12
- package/tsconfig.json +0 -23
package/package.nls.zh-CN.json
DELETED
|
@@ -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
|
-
}
|
package/package.nls.zh-TW.json
DELETED
|
@@ -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
|
-
}
|
package/src/commands/activate.ts
DELETED
|
@@ -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 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
|
-
};
|
package/src/commands/folders.ts
DELETED
|
@@ -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
|
-
};
|
package/src/commands/index.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { commands } from 'vscode';
|
|
2
|
-
import { activateIcons } from './activate';
|
|
3
|
-
import { toggleExplorerArrows } from './explorerArrows';
|
|
4
|
-
import { changeFolderColor } from './folderColor';
|
|
5
|
-
import { changeFolderTheme } from './folders';
|
|
6
|
-
import { toggleGrayscale } from './grayscale';
|
|
7
|
-
import { toggleIconPacks } from './iconPacks';
|
|
8
|
-
import { changeOpacity } from './opacity';
|
|
9
|
-
import { restoreDefaultConfig } from './restoreConfig';
|
|
10
|
-
import { changeSaturation } from './saturation';
|
|
11
|
-
|
|
12
|
-
const extensionCommands: { [commmand: string]: () => Promise<void> } = {
|
|
13
|
-
activateIcons,
|
|
14
|
-
toggleIconPacks,
|
|
15
|
-
changeFolderTheme,
|
|
16
|
-
changeFolderColor,
|
|
17
|
-
restoreDefaultConfig,
|
|
18
|
-
toggleExplorerArrows,
|
|
19
|
-
changeOpacity,
|
|
20
|
-
toggleGrayscale,
|
|
21
|
-
changeSaturation,
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const registered = Object.keys(extensionCommands).map((commandName) => {
|
|
25
|
-
const callCommand = () => extensionCommands[commandName]();
|
|
26
|
-
return commands.registerCommand(
|
|
27
|
-
`material-icon-theme.${commandName}`,
|
|
28
|
-
callCommand
|
|
29
|
-
);
|
|
30
|
-
});
|
package/src/commands/opacity.ts
DELETED
|
@@ -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,14 +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('hidesExplorerArrows', undefined, true);
|
|
9
|
-
await setThemeConfig('opacity', undefined, true);
|
|
10
|
-
await setThemeConfig('saturation', undefined, true);
|
|
11
|
-
await setThemeConfig('files.associations', undefined, true);
|
|
12
|
-
await setThemeConfig('folders.associations', undefined, true);
|
|
13
|
-
await setThemeConfig('languages.associations', undefined, true);
|
|
14
|
-
};
|
|
@@ -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
|
-
};
|
package/src/extension.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
import { ExtensionContext, window as codeWindow, workspace } from 'vscode';
|
|
4
|
-
import { registered } from './commands';
|
|
5
|
-
import { detectConfigChanges } from './helpers/changeDetection';
|
|
6
|
-
import { initTranslations } from './i18n';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* This method is called when the extension is activated.
|
|
10
|
-
* It initializes the core functionality of the extension.
|
|
11
|
-
*/
|
|
12
|
-
export const activate = async (context: ExtensionContext) => {
|
|
13
|
-
try {
|
|
14
|
-
await initTranslations();
|
|
15
|
-
|
|
16
|
-
// Subscribe to the extension commands
|
|
17
|
-
context.subscriptions.push(...registered);
|
|
18
|
-
|
|
19
|
-
// Initially trigger the config change detection
|
|
20
|
-
detectConfigChanges();
|
|
21
|
-
|
|
22
|
-
// Observe changes in the config
|
|
23
|
-
workspace.onDidChangeConfiguration(detectConfigChanges);
|
|
24
|
-
|
|
25
|
-
// Observe if the window got focused to trigger config changes
|
|
26
|
-
codeWindow.onDidChangeWindowState((state) => {
|
|
27
|
-
if (state.focused) {
|
|
28
|
-
detectConfigChanges();
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
} catch (error) {
|
|
32
|
-
console.error(error);
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
/** This method is called when the extension is deactivated */
|
|
37
|
-
export const deactivate = () => {};
|