material-icon-theme 4.23.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.
- package/.eslintrc.json +51 -51
- package/.github/workflows/build.yml +45 -45
- package/.github/workflows/color-check.yml +22 -22
- package/.github/workflows/release.yml +73 -73
- package/.vscodeignore +21 -21
- package/CHANGELOG.md +1292 -1281
- package/README.md +199 -199
- package/icons/craco.svg +45 -45
- package/icons/folder-changesets-open.svg +5 -5
- package/icons/folder-changesets.svg +2 -2
- package/icons/folder-decorators-open.svg +2 -2
- package/icons/folder-decorators.svg +5 -5
- package/icons/folder-supabase-open.svg +5 -5
- package/icons/folder-supabase.svg +2 -2
- package/icons/sonarcloud.svg +4 -4
- package/icons/stylable.svg +10 -10
- package/icons/supabase.svg +4 -4
- package/icons/vitest.svg +6 -0
- package/images/contributors.png +0 -0
- package/images/fileIcons.png +0 -0
- package/package.json +252 -252
- package/package.nls.de.json +32 -32
- package/package.nls.es.json +29 -29
- package/package.nls.fr.json +29 -29
- package/package.nls.ja.json +32 -32
- package/package.nls.json +32 -32
- package/package.nls.nl.json +32 -32
- package/package.nls.pl.json +32 -32
- package/package.nls.pt-BR.json +29 -29
- package/package.nls.pt-PT.json +29 -29
- package/package.nls.ru.json +29 -29
- package/package.nls.zh-CN.json +29 -29
- package/package.nls.zh-TW.json +29 -29
- package/src/commands/activate.ts +28 -28
- package/src/commands/explorerArrows.ts +55 -55
- package/src/commands/folderColor.ts +96 -96
- package/src/commands/folders.ts +55 -55
- package/src/commands/grayscale.ts +55 -55
- package/src/commands/iconPacks.ts +64 -64
- package/src/commands/index.ts +30 -30
- package/src/commands/opacity.ts +46 -46
- package/src/commands/saturation.ts +46 -46
- package/src/extension.ts +37 -37
- package/src/helpers/customIcons.ts +8 -8
- package/src/helpers/index.ts +88 -88
- package/src/i18n/index.ts +78 -78
- package/src/i18n/lang-de.ts +43 -43
- package/src/i18n/lang-en.ts +43 -43
- package/src/i18n/lang-es.ts +43 -43
- package/src/i18n/lang-fr.ts +43 -43
- package/src/i18n/lang-ja.ts +43 -43
- package/src/i18n/lang-nl.ts +43 -43
- package/src/i18n/lang-pl.ts +43 -43
- package/src/i18n/lang-pt-br.ts +43 -43
- package/src/i18n/lang-pt-pt.ts +43 -43
- package/src/i18n/lang-ru.ts +43 -43
- package/src/i18n/lang-uk.ts +43 -43
- package/src/i18n/lang-zh-cn.ts +43 -43
- package/src/i18n/lang-zh-tw.ts +43 -43
- package/src/icons/fileIcons.ts +2197 -2182
- package/src/icons/folderIcons.ts +806 -806
- package/src/icons/generator/folderGenerator.ts +340 -340
- package/src/icons/generator/iconOpacity.ts +111 -111
- package/src/icons/generator/iconSaturation.ts +140 -140
- package/src/icons/generator/jsonGenerator.ts +191 -191
- package/src/icons/languageIcons.ts +141 -141
- package/src/models/i18n/translation.ts +41 -41
- package/src/models/iconConfiguration.ts +37 -37
- package/src/models/icons/iconJsonOptions.ts +21 -21
- package/src/models/index.ts +3 -3
- package/src/scripts/contributors/index.ts +138 -138
- package/src/scripts/helpers/screenshots.ts +32 -32
- package/src/scripts/icons/checks/checkIconAvailability.ts +215 -215
- package/src/scripts/icons/checks/checkIconConflicts.ts +152 -152
- package/src/scripts/icons/checks/checkIconUsage.ts +137 -137
- package/src/scripts/icons/checks/index.ts +7 -7
- package/src/scripts/preview/index.ts +40 -40
- package/src/scripts/preview/preview.ts +163 -163
- package/src/test/runTest.ts +26 -26
- package/src/test/spec/i18n/i18n.spec.ts +54 -54
- package/src/test/spec/icons/fileIcons.spec.ts +250 -250
- package/src/test/spec/icons/folderIcons.spec.ts +418 -418
- package/src/test/spec/icons/languageIcons.spec.ts +184 -184
|
@@ -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
|
+
};
|
|
@@ -1,64 +1,64 @@
|
|
|
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
|
+
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
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
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
|
-
});
|
|
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
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
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
|
+
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,46 +1,46 @@
|
|
|
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
|
-
};
|
|
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
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
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 = () => {};
|
|
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 = () => {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { dirname, join } from 'path';
|
|
2
|
-
import { IconJsonOptions } from '../models';
|
|
3
|
-
|
|
4
|
-
export const getCustomIconPaths = (options: IconJsonOptions) => {
|
|
5
|
-
return Object.values(options?.files?.associations ?? {})
|
|
6
|
-
.filter((v) => v.match(/^[.\/]+/)) // <- custom dirs have a relative path to the dist folder
|
|
7
|
-
.map((v) => dirname(join(__dirname, v)));
|
|
8
|
-
};
|
|
1
|
+
import { dirname, join } from 'path';
|
|
2
|
+
import { IconJsonOptions } from '../models';
|
|
3
|
+
|
|
4
|
+
export const getCustomIconPaths = (options: IconJsonOptions) => {
|
|
5
|
+
return Object.values(options?.files?.associations ?? {})
|
|
6
|
+
.filter((v) => v.match(/^[.\/]+/)) // <- custom dirs have a relative path to the dist folder
|
|
7
|
+
.map((v) => dirname(join(__dirname, v)));
|
|
8
|
+
};
|