chore: Alters programmatically the current theme (colour, icons) to adapt it to accents and folders colours.
This commit is contained in:
parent
2012046243
commit
c2a4ba12ac
19 changed files with 815 additions and 206 deletions
|
@ -1,46 +0,0 @@
|
||||||
import * as fs from 'fs'
|
|
||||||
import * as path from 'path'
|
|
||||||
|
|
||||||
import { IPackageJSON, IPackageJSONThemeIcons } from "../interfaces/ipackage.json";
|
|
||||||
|
|
||||||
import { CHARSET } from "../consts/files";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @export
|
|
||||||
* @param {string} id
|
|
||||||
* @param {string} label
|
|
||||||
* @param {string} path
|
|
||||||
* @param {IPackageJSON} topackage
|
|
||||||
* @returns {IPackageJSON}
|
|
||||||
*/
|
|
||||||
export function addContributeIconTheme(id: string, label: string, path: string, topackage: IPackageJSON): IPackageJSON {
|
|
||||||
let contribute: IPackageJSONThemeIcons = { id, label, path };
|
|
||||||
|
|
||||||
if (id === null || id === undefined) {
|
|
||||||
throw new TypeError(`addContributeIconTheme: variable id must be a string, got ${ Object.prototype.toString.call(id) }`);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (label === null || label === undefined) {
|
|
||||||
throw new TypeError(`addContributeIconTheme: variable label must be a string, got ${ Object.prototype.toString.call(label) }`);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (path === null || path === undefined) {
|
|
||||||
throw new TypeError(`addContributeIconTheme: variable path must be a string, got ${ Object.prototype.toString.call(path) }`);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (topackage === null || topackage === undefined) {
|
|
||||||
throw new TypeError(`addContributeIconTheme: variable topackage must be a string, got ${ Object.prototype.toString.call(topackage) }`);
|
|
||||||
}
|
|
||||||
|
|
||||||
topackage.contributes.iconThemes.push(contribute);
|
|
||||||
|
|
||||||
return topackage;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @export
|
|
||||||
* @param {IPackageJSON} packageJSON
|
|
||||||
*/
|
|
||||||
export function writePackageJSON(packageJSON: IPackageJSON): void {
|
|
||||||
fs.writeFileSync(path.join(process.cwd(), './package.json'), JSON.stringify(packageJSON, null, 2), CHARSET);
|
|
||||||
}
|
|
|
@ -3,24 +3,25 @@ import * as gulp from 'gulp';
|
||||||
import * as gutil from 'gulp-util';
|
import * as gutil from 'gulp-util';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
import { IPackageJSON, IPackageJSONThemeIcons } from "../interfaces/ipackage.json";
|
|
||||||
import { MESSAGE_GENERATED, MESSAGE_ICON_ACCENTS_ERROR } from "../consts/log";
|
import { MESSAGE_GENERATED, MESSAGE_ICON_ACCENTS_ERROR } from "../consts/log";
|
||||||
import { addContributeIconTheme, writePackageJSON } from "../helpers/contribute-icon-theme";
|
|
||||||
|
|
||||||
import { CHARSET } from "../consts/files";
|
import { CHARSET } from "../../extensions/consts/files";
|
||||||
import { IThemeConfigCommons } from '../../extensions/interfaces/icommons';
|
import { IThemeConfigCommons } from '../../extensions/interfaces/icommons';
|
||||||
import { IThemeIconsAccents } from "../interfaces/itheme-icons-accents";
|
import { IThemeIconsAccents } from "../interfaces/itheme-icons-accents";
|
||||||
import PATHS from '../../extensions/consts/paths'
|
import PATHS from '../../extensions/consts/paths'
|
||||||
|
|
||||||
const BASE_ICON_THEME_PATH: string = path.join(process.cwd(), PATHS.THEMES, './Material-Theme-Icons.json');
|
// import { IPackageJSON } from "../../extensions/interfaces/ipackage.json";
|
||||||
const THEME_COMMONS: IThemeConfigCommons = require('../../extensions/accents-setter/commons.json');
|
// import { writePackageJSON } from "../helpers/contribute-icon-theme";
|
||||||
const PACKAGE_JSON: IPackageJSON = require('../../package.json');
|
|
||||||
|
|
||||||
const PACKAGE_JSON_ICON_THEME: IPackageJSONThemeIcons = {
|
const BASE_ICON_THEME_PATH: string = path.join(process.cwd(), PATHS.THEMES, './Material-Theme-Icons.json');
|
||||||
id: "material-theme-icons",
|
const THEME_COMMONS: IThemeConfigCommons = require('../../extensions/commands/accents-setter/commons.json');
|
||||||
label: "Material Theme Icons",
|
// const PACKAGE_JSON: IPackageJSON = require('../../package.json');
|
||||||
path: "./themes/Material-Theme-Icons.json"
|
|
||||||
}
|
// const PACKAGE_JSON_ICON_THEME: IPackageJSONThemeIcons = {
|
||||||
|
// id: "material-theme-icons",
|
||||||
|
// label: "Material Theme Icons",
|
||||||
|
// path: "./themes/Material-Theme-Icons.json"
|
||||||
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Normalizes icon path
|
* Normalizes icon path
|
||||||
|
@ -88,7 +89,7 @@ function writeSVGIcon(fromFile: string, toFile: string, accent: string): void {
|
||||||
export default gulp.task('build:icons.accents', cb => {
|
export default gulp.task('build:icons.accents', cb => {
|
||||||
let basetheme: IThemeIconsAccents;
|
let basetheme: IThemeIconsAccents;
|
||||||
|
|
||||||
PACKAGE_JSON.contributes.iconThemes = [ PACKAGE_JSON_ICON_THEME ];
|
// PACKAGE_JSON.contributes.iconThemes = [ PACKAGE_JSON_ICON_THEME ];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
basetheme = require(BASE_ICON_THEME_PATH);
|
basetheme = require(BASE_ICON_THEME_PATH);
|
||||||
|
@ -98,9 +99,9 @@ export default gulp.task('build:icons.accents', cb => {
|
||||||
let themecopy: IThemeIconsAccents = JSON.parse(JSON.stringify(basetheme));
|
let themecopy: IThemeIconsAccents = JSON.parse(JSON.stringify(basetheme));
|
||||||
let themePath: string = path.join(PATHS.THEMES, `./Material-Theme-Icons-${ key }.json`);
|
let themePath: string = path.join(PATHS.THEMES, `./Material-Theme-Icons-${ key }.json`);
|
||||||
|
|
||||||
let id: string = `${ PACKAGE_JSON_ICON_THEME.id }-${ key.replace(/\s+/g, '-').toLowerCase() }`;
|
// let id: string = `${ PACKAGE_JSON_ICON_THEME.id }-${ key.replace(/\s+/g, '-').toLowerCase() }`;
|
||||||
let label: string = `${ PACKAGE_JSON_ICON_THEME.label } - ${ key } accent`;
|
// let label: string = `${ PACKAGE_JSON_ICON_THEME.label } - ${ key } accent`;
|
||||||
let themepathJSON: string = `./${ themePath }`;
|
// let themepathJSON: string = `./${ themePath }`;
|
||||||
|
|
||||||
themecopy.iconDefinitions._folder_open.iconPath = replaceNameWithAccent(basetheme.iconDefinitions._folder_open.iconPath, iconName);
|
themecopy.iconDefinitions._folder_open.iconPath = replaceNameWithAccent(basetheme.iconDefinitions._folder_open.iconPath, iconName);
|
||||||
themecopy.iconDefinitions._folder_open_build.iconPath = replaceNameWithAccent(basetheme.iconDefinitions._folder_open_build.iconPath, iconName);
|
themecopy.iconDefinitions._folder_open_build.iconPath = replaceNameWithAccent(basetheme.iconDefinitions._folder_open_build.iconPath, iconName);
|
||||||
|
@ -108,14 +109,14 @@ export default gulp.task('build:icons.accents', cb => {
|
||||||
writeSVGIcon(basetheme.iconDefinitions._folder_open.iconPath, themecopy.iconDefinitions._folder_open.iconPath, key);
|
writeSVGIcon(basetheme.iconDefinitions._folder_open.iconPath, themecopy.iconDefinitions._folder_open.iconPath, key);
|
||||||
writeSVGIcon(basetheme.iconDefinitions._folder_open_build.iconPath, themecopy.iconDefinitions._folder_open_build.iconPath, key);
|
writeSVGIcon(basetheme.iconDefinitions._folder_open_build.iconPath, themecopy.iconDefinitions._folder_open_build.iconPath, key);
|
||||||
|
|
||||||
fs.writeFileSync(themePath, JSON.stringify(themecopy));
|
// fs.writeFileSync(themePath, JSON.stringify(themecopy));
|
||||||
|
|
||||||
addContributeIconTheme(id, label, themepathJSON, PACKAGE_JSON);
|
// addContributeIconTheme(id, label, themepathJSON, PACKAGE_JSON);
|
||||||
|
|
||||||
gutil.log(gutil.colors.green(MESSAGE_GENERATED, themePath));
|
gutil.log(gutil.colors.green(MESSAGE_GENERATED, themePath));
|
||||||
});
|
});
|
||||||
|
|
||||||
writePackageJSON(PACKAGE_JSON);
|
// writePackageJSON(PACKAGE_JSON);
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// http://ragefaces.memesoftware.com/faces/large/misc-le-fu-l.png
|
// http://ragefaces.memesoftware.com/faces/large/misc-le-fu-l.png
|
||||||
|
|
|
@ -2,11 +2,9 @@ import * as fs from 'fs';
|
||||||
import * as gulp from 'gulp';
|
import * as gulp from 'gulp';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
import { addContributeIconTheme, writePackageJSON } from "../helpers/contribute-icon-theme";
|
import { CHARSET } from "../../extensions/consts/files";
|
||||||
|
|
||||||
import { CHARSET } from "../consts/files";
|
|
||||||
import { IGenericObject } from "../../extensions/interfaces/igeneric-object";
|
import { IGenericObject } from "../../extensions/interfaces/igeneric-object";
|
||||||
import { IPackageJSON } from "../interfaces/ipackage.json";
|
import { IPackageJSON } from "../../extensions/interfaces/ipackage.json";
|
||||||
import { IThemeIconsVariants } from "../interfaces/itheme-icons-variants";
|
import { IThemeIconsVariants } from "../interfaces/itheme-icons-variants";
|
||||||
import PATHS from '../../extensions/consts/paths'
|
import PATHS from '../../extensions/consts/paths'
|
||||||
|
|
||||||
|
@ -38,29 +36,18 @@ export default gulp.task('build:icons.variants', callback => {
|
||||||
|
|
||||||
let basepath: string = path.join(process.cwd(), contribute.path);
|
let basepath: string = path.join(process.cwd(), contribute.path);
|
||||||
let basetheme: IThemeIconsVariants = require(basepath);
|
let basetheme: IThemeIconsVariants = require(basepath);
|
||||||
let themepath: string = path.join(process.cwd(), contribute.path.replace('.json', `.${ variantName }.json`));
|
|
||||||
let theme: IThemeIconsVariants = JSON.parse(JSON.stringify(basetheme));
|
let theme: IThemeIconsVariants = JSON.parse(JSON.stringify(basetheme));
|
||||||
|
|
||||||
let contributeID: string = `${ contribute.id }-${ variantName.toLowerCase() }`;
|
|
||||||
let contributeLabel: string = `${ contribute.label } - ${ variantName }`
|
|
||||||
let contributePath: string = path.relative(process.cwd(), themepath);
|
|
||||||
|
|
||||||
theme.iconDefinitions._folder_dark.iconPath = theme.iconDefinitions._folder_dark.iconPath.replace('.svg', `${ variantName }.svg`);
|
theme.iconDefinitions._folder_dark.iconPath = theme.iconDefinitions._folder_dark.iconPath.replace('.svg', `${ variantName }.svg`);
|
||||||
theme.iconDefinitions._file_folder.iconPath = theme.iconDefinitions._file_folder.iconPath.replace('.svg', `${ variantName }.svg`);
|
theme.iconDefinitions._file_folder.iconPath = theme.iconDefinitions._file_folder.iconPath.replace('.svg', `${ variantName }.svg`);
|
||||||
theme.iconDefinitions["_file_folder-build"].iconPath = theme.iconDefinitions["_file_folder-build"].iconPath.replace('.svg', `${ variantName }.svg`);
|
theme.iconDefinitions["_file_folder-build"].iconPath = theme.iconDefinitions["_file_folder-build"].iconPath.replace('.svg', `${ variantName }.svg`);
|
||||||
|
|
||||||
fs.writeFileSync(themepath, JSON.stringify(theme), CHARSET);
|
|
||||||
|
|
||||||
writeIconVariant(basetheme.iconDefinitions._folder_dark.iconPath, theme.iconDefinitions._folder_dark.iconPath, variants[variantName]);
|
writeIconVariant(basetheme.iconDefinitions._folder_dark.iconPath, theme.iconDefinitions._folder_dark.iconPath, variants[variantName]);
|
||||||
writeIconVariant(basetheme.iconDefinitions._file_folder.iconPath, theme.iconDefinitions._file_folder.iconPath, variants[variantName]);
|
writeIconVariant(basetheme.iconDefinitions._file_folder.iconPath, theme.iconDefinitions._file_folder.iconPath, variants[variantName]);
|
||||||
writeIconVariant(basetheme.iconDefinitions["_file_folder-build"].iconPath, theme.iconDefinitions["_file_folder-build"].iconPath, variants[variantName]);
|
writeIconVariant(basetheme.iconDefinitions["_file_folder-build"].iconPath, theme.iconDefinitions["_file_folder-build"].iconPath, variants[variantName]);
|
||||||
|
|
||||||
addContributeIconTheme(contributeID, contributeLabel, contributePath, PACKAGE_JSON);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
writePackageJSON(PACKAGE_JSON);
|
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
callback(error);
|
callback(error);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -6,7 +6,7 @@ import * as path from 'path';
|
||||||
|
|
||||||
import { HR, MESSAGE_GENERATED, MESSAGE_ICON_ERROR } from './../consts/log';
|
import { HR, MESSAGE_GENERATED, MESSAGE_ICON_ERROR } from './../consts/log';
|
||||||
|
|
||||||
import { CHARSET } from '../consts/files';
|
import { CHARSET } from "../../extensions/consts/files";
|
||||||
import { IIcon } from './../interfaces/iicon';
|
import { IIcon } from './../interfaces/iicon';
|
||||||
import { IPlainObject } from '../interfaces/iplain-object';
|
import { IPlainObject } from '../interfaces/iplain-object';
|
||||||
import paths from '../../extensions/consts/paths';
|
import paths from '../../extensions/consts/paths';
|
||||||
|
|
|
@ -6,11 +6,11 @@ import * as path from 'path';
|
||||||
|
|
||||||
import { HR, MESSAGE_GENERATED, MESSAGE_THEME_VARIANT_PARSE_ERROR } from './../consts/log';
|
import { HR, MESSAGE_GENERATED, MESSAGE_THEME_VARIANT_PARSE_ERROR } from './../consts/log';
|
||||||
|
|
||||||
import { CHARSET } from '../consts/files';
|
import { CHARSET } from "../../extensions/consts/files";
|
||||||
import { IThemeVariant } from './../interfaces/itheme-variant';
|
import { IThemeVariant } from './../interfaces/itheme-variant';
|
||||||
import paths from '../../extensions/consts/paths';
|
import paths from '../../extensions/consts/paths';
|
||||||
|
|
||||||
let commons = require('../../extensions/accents-setter/commons.json');
|
let commons = require('../../extensions/commands/accents-setter/commons.json');
|
||||||
|
|
||||||
let themeTemplateFileContent: string = fs.readFileSync(path.join(paths.SRC, `/themes/theme-template-color-theme.json`), CHARSET);
|
let themeTemplateFileContent: string = fs.readFileSync(path.join(paths.SRC, `/themes/theme-template-color-theme.json`), CHARSET);
|
||||||
let themeVariants: IThemeVariant[] = [];
|
let themeVariants: IThemeVariant[] = [];
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
|
|
||||||
import { IAccentCustomProperty } from "../interfaces/iaccent-custom-property";
|
import { getCurrentThemeID, getCurrentThemeIconsID, reloadWindow } from "../../helpers/vscode";
|
||||||
import { IGenericObject } from "../interfaces/igeneric-object";
|
import { getDefaultValues, getPackageJSON, getThemeIconsByContributeID, getThemeIconsContribute, writeFile } from "../../helpers/fs";
|
||||||
import { IThemeConfigCommons } from "../interfaces/icommons";
|
|
||||||
|
import {IAccentCustomProperty} from '../../interfaces/iaccent-custom-property';
|
||||||
|
import {IGenericObject} from '../../interfaces/igeneric-object';
|
||||||
|
import {IThemeConfigCommons} from '../../interfaces/icommons';
|
||||||
|
|
||||||
const REGEXP_HEX: RegExp = /^#([0-9A-F]{6}|[0-9A-F]{8})$/i;
|
const REGEXP_HEX: RegExp = /^#([0-9A-F]{6}|[0-9A-F]{8})$/i;
|
||||||
|
|
||||||
|
@ -62,45 +65,44 @@ function assignColorCustomizations(colour: string, config: any): void {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the accented icon theme name
|
|
||||||
* @param accentName
|
|
||||||
*/
|
|
||||||
function accentedThemeName(accentName: string): string {
|
|
||||||
return `material-theme-icons-${ accentName.replace(/\s+/g, '-').toLowerCase() }`;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assigns related icons theme name by accent name
|
* Assigns related icons theme name by accent name
|
||||||
* @param accentName
|
* @param accentName
|
||||||
*/
|
*/
|
||||||
function assignIconTheme(accentName: string | undefined): void {
|
export function assignIconTheme(accentName: string | undefined): void {
|
||||||
let accentValue: string;
|
// let accentValue: string;
|
||||||
let cacheKey: string = 'materialTheme.cache.workbench.iconTheme';
|
let cacheKey: string = 'materialTheme.cache.workbench.accent';
|
||||||
let cache: any = vscode.workspace.getConfiguration().inspect(cacheKey);
|
let themeIconsID: string = getCurrentThemeIconsID();
|
||||||
let currentTheme: any = vscode.workspace.getConfiguration().inspect('workbench.colorTheme');
|
let themeID: string = getCurrentThemeID();
|
||||||
let materialThemeName: string = 'Material Theme';
|
let packageJSON = getPackageJSON();
|
||||||
|
|
||||||
if (!cache.globalValue && accentName !== undefined) {
|
if (packageJSON.contributes.iconThemes.filter(contribute => contribute.id === themeIconsID).length > 0) {
|
||||||
vscode.workspace.getConfiguration().update(cacheKey, vscode.workspace.getConfiguration().get('workbench.iconTheme'), true).then(() => {}, reason => vscode.window.showErrorMessage(reason));
|
let defaults = getDefaultValues();
|
||||||
|
let theme = getThemeIconsByContributeID(themeIconsID);
|
||||||
|
let themeContribute = getThemeIconsContribute(themeIconsID);
|
||||||
|
|
||||||
|
if (accentName !== undefined) {
|
||||||
|
accentName = accentName.replace(/\s+/, '-');
|
||||||
|
theme.iconDefinitions._folder_open.iconPath = defaults.icons.theme.iconDefinitions._folder_open.iconPath.replace('.svg', `.accent.${ accentName }.svg`);
|
||||||
|
theme.iconDefinitions._folder_open_build.iconPath = defaults.icons.theme.iconDefinitions._folder_open_build.iconPath.replace('.svg', `.accent.${ accentName }.svg`);
|
||||||
|
} else {
|
||||||
|
theme.iconDefinitions._folder_open.iconPath = defaults.icons.theme.iconDefinitions._folder_open.iconPath;
|
||||||
|
theme.iconDefinitions._folder_open_build.iconPath = defaults.icons.theme.iconDefinitions._folder_open_build.iconPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (accentName === undefined && cache.globalValue) {
|
writeFile(themeContribute.path, JSON.stringify(theme));
|
||||||
accentValue = vscode.workspace.getConfiguration().get<string>(cacheKey);
|
|
||||||
vscode.workspace.getConfiguration().update(cacheKey, undefined, true);
|
|
||||||
} else if (accentName !== undefined) {
|
|
||||||
accentValue = accentedThemeName(accentName);
|
|
||||||
|
|
||||||
if (!!currentTheme.globalValue && currentTheme.globalValue.indexOf(materialThemeName) >= 0) {
|
vscode.workspace.getConfiguration().update(cacheKey, accentName, true);
|
||||||
let variantName: string | undefined = currentTheme.globalValue.split(materialThemeName)[1];
|
|
||||||
|
|
||||||
accentValue = `${ accentValue }-${ !!variantName ? variantName.trim().toLowerCase() : 'default' }`;
|
vscode.workspace.getConfiguration().update('workbench.iconTheme', themeIconsID, true).then(() => {
|
||||||
|
// In order to load modified icons we will have to reload the whole window.
|
||||||
|
if (packageJSON.contributes.themes.filter(theme => theme.label === themeID).length > 0 && packageJSON.contributes.iconThemes.filter(theme => theme.id === themeIconsID).length > 0) {
|
||||||
|
reloadWindow();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
vscode.workspace.getConfiguration().update('workbench.iconTheme', accentValue, true).then(() => {}, reason => {
|
|
||||||
vscode.window.showErrorMessage(reason);
|
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
vscode.workspace.getConfiguration().update(cacheKey, accentName, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
50
extensions/commands/theme-icons/index.ts
Normal file
50
extensions/commands/theme-icons/index.ts
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
import * as fs from 'fs';
|
||||||
|
import * as vscode from 'vscode';
|
||||||
|
|
||||||
|
import { getAbsolutePath, getDefaultValues, getPackageJSON, getThemeIconsByContributeID, getThemeIconsContribute } from "../../helpers/fs";
|
||||||
|
import { getCurrentThemeID, getCurrentThemeIconsID, reloadWindow } from "../../helpers/vscode";
|
||||||
|
|
||||||
|
import { CHARSET } from "../../consts/files";
|
||||||
|
import { IPackageJSONThemeIcons } from "../../interfaces/ipackage.json";
|
||||||
|
import { IThemeIcons } from "../../interfaces/itheme-icons";
|
||||||
|
import { assignIconTheme } from "../accents-setter/index";
|
||||||
|
|
||||||
|
export const THEME_CHANGE_LISTENER = () => {
|
||||||
|
vscode.workspace.onDidChangeConfiguration(() => {
|
||||||
|
let cacheKey: string = 'materialTheme.cache.workbench.accent';
|
||||||
|
let cache = vscode.workspace.getConfiguration().get<any>(cacheKey);
|
||||||
|
let themeID: string = getCurrentThemeID();
|
||||||
|
let themeIconsID: string = getCurrentThemeIconsID();
|
||||||
|
|
||||||
|
if (themeIconsID && /material-theme/i.test(themeIconsID)) {
|
||||||
|
let defaults = getDefaultValues();
|
||||||
|
let packageJSON = getPackageJSON();
|
||||||
|
let variantNames: string[] = themeID.split('Material Theme');
|
||||||
|
let variantName: string = variantNames[1] === undefined ? '' : variantNames[1].trim();
|
||||||
|
let themeContribute: IPackageJSONThemeIcons = getThemeIconsContribute(themeIconsID);
|
||||||
|
let theme: IThemeIcons = getThemeIconsByContributeID(themeIconsID);
|
||||||
|
let themepath: string = getAbsolutePath(themeContribute.path);
|
||||||
|
|
||||||
|
theme.iconDefinitions._folder_dark.iconPath = defaults.icons.theme.iconDefinitions._folder_dark.iconPath.replace('.svg', `${ variantName }.svg`);
|
||||||
|
theme.iconDefinitions._file_folder.iconPath = defaults.icons.theme.iconDefinitions._file_folder.iconPath.replace('.svg', `${ variantName }.svg`);
|
||||||
|
theme.iconDefinitions["_file_folder-build"].iconPath = defaults.icons.theme.iconDefinitions["_file_folder-build"].iconPath.replace('.svg', `${ variantName }.svg`);
|
||||||
|
|
||||||
|
if (!!cache && cache.globalValue) {
|
||||||
|
assignIconTheme(cacheKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
theme.iconDefinitions._folder_dark.iconPath
|
||||||
|
, theme.iconDefinitions._file_folder.iconPath
|
||||||
|
)
|
||||||
|
|
||||||
|
fs.writeFileSync(themepath, JSON.stringify(theme), CHARSET);
|
||||||
|
|
||||||
|
vscode.workspace.getConfiguration().update('workbench.iconTheme', themeIconsID, true).then(() => {
|
||||||
|
if (packageJSON.contributes.themes.filter(theme => theme.label === themeID).length > 0 && packageJSON.contributes.iconThemes.filter(theme => theme.id ===themeIconsID).length > 0) {
|
||||||
|
reloadWindow();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
|
@ -1,10 +1,13 @@
|
||||||
|
import * as path from 'path';
|
||||||
|
|
||||||
import { IPaths } from '../interfaces/ipaths';
|
import { IPaths } from '../interfaces/ipaths';
|
||||||
|
|
||||||
const PATHS: IPaths = {
|
export const PATHS: IPaths = {
|
||||||
DIST: './dist',
|
DIST: './dist',
|
||||||
ICONS: './icons',
|
ICONS: './icons',
|
||||||
SRC: './src',
|
SRC: './src',
|
||||||
THEMES: './themes',
|
THEMES: './themes',
|
||||||
|
VSIX_DIR: path.join(__dirname, '../../'),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default PATHS;
|
export default PATHS;
|
||||||
|
|
29
extensions/defaults.json
Normal file
29
extensions/defaults.json
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
{
|
||||||
|
"icons": {
|
||||||
|
"theme": {
|
||||||
|
"iconDefinitions": {
|
||||||
|
"_folder_dark": {
|
||||||
|
"iconPath": "../icons/folder.svg"
|
||||||
|
},
|
||||||
|
"_file_folder": {
|
||||||
|
"iconPath": "../icons/folder.svg"
|
||||||
|
},
|
||||||
|
"_file_folder-build": {
|
||||||
|
"iconPath": "../icons/folder-build.svg"
|
||||||
|
},
|
||||||
|
"_folder_open": {
|
||||||
|
"iconPath": "../icons/folder-outline.svg"
|
||||||
|
},
|
||||||
|
"_folder_open_build": {
|
||||||
|
"iconPath": "../icons/folder-outline-build.svg"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"themeVariants": {
|
||||||
|
"Darker": "#424242",
|
||||||
|
"Default": "#4A616C",
|
||||||
|
"Light": "#90A4AE",
|
||||||
|
"Palenight": "#4E5579"
|
||||||
|
}
|
||||||
|
}
|
80
extensions/helpers/fs.ts
Normal file
80
extensions/helpers/fs.ts
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
import * as fs from 'fs'
|
||||||
|
import * as path from 'path'
|
||||||
|
|
||||||
|
import { IPackageJSON, IPackageJSONThemeIcons } from "../interfaces/ipackage.json";
|
||||||
|
|
||||||
|
import { CHARSET } from "../consts/files";
|
||||||
|
import { IDefaults } from "../interfaces/idefaults";
|
||||||
|
import { IThemeIcons } from "../interfaces/itheme-icons";
|
||||||
|
import { PATHS } from "../consts/paths";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets default value
|
||||||
|
* @export
|
||||||
|
* @returns {IDefaults}
|
||||||
|
*/
|
||||||
|
export function getDefaultValues(): IDefaults {
|
||||||
|
let defaults: IDefaults = require(path.join(PATHS.VSIX_DIR, './extensions/defaults.json'));
|
||||||
|
|
||||||
|
if (defaults === undefined || defaults === null) {
|
||||||
|
throw new Error('Cannot find defaults params');
|
||||||
|
}
|
||||||
|
|
||||||
|
return defaults;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets an absolute path
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
* @param {string} input
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
export function getAbsolutePath(input: string): string {
|
||||||
|
return path.join(PATHS.VSIX_DIR, input);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a theme content by a given contribute ID
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
* @param {string} ID
|
||||||
|
* @returns {IThemeIcons}
|
||||||
|
*/
|
||||||
|
export function getThemeIconsByContributeID(ID: string): IThemeIcons | null {
|
||||||
|
let contribute: IPackageJSONThemeIcons = getThemeIconsContribute(ID)
|
||||||
|
return contribute !== null ? require(path.join(PATHS.VSIX_DIR, contribute.path)) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a theme by name
|
||||||
|
* @export
|
||||||
|
* @param {string} name
|
||||||
|
* @returns {IThemeIcons}
|
||||||
|
*/
|
||||||
|
export function getThemeIconsContribute(ID: string): IPackageJSONThemeIcons {
|
||||||
|
let contributes = getPackageJSON().contributes.iconThemes.filter(contribute => contribute.id === ID);
|
||||||
|
return contributes[0] !== undefined ? contributes[0] : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets package JSON
|
||||||
|
* @export
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
export function getPackageJSON(): IPackageJSON {
|
||||||
|
let packageJSON: IPackageJSON = require(path.join(PATHS.VSIX_DIR, './package.json'));
|
||||||
|
return packageJSON;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes a file inside the vsix directory
|
||||||
|
* @export
|
||||||
|
* @param {string} filename
|
||||||
|
* @param {string} filecontent
|
||||||
|
*/
|
||||||
|
export function writeFile(filename: string, filecontent: string): void {
|
||||||
|
filename = path.join(PATHS.VSIX_DIR, filename);
|
||||||
|
console.log(arguments)
|
||||||
|
fs.writeFileSync(filename, filecontent, CHARSET);
|
||||||
|
}
|
27
extensions/helpers/vscode.ts
Normal file
27
extensions/helpers/vscode.ts
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
import * as vscode from 'vscode'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets your current theme ID
|
||||||
|
* @export
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
export function getCurrentThemeID(): string {
|
||||||
|
return vscode.workspace.getConfiguration().get<string>('workbench.colorTheme');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets your current icons theme ID
|
||||||
|
* @export
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
export function getCurrentThemeIconsID(): string {
|
||||||
|
return vscode.workspace.getConfiguration().get<string>('workbench.iconTheme');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reloads current vscode window.
|
||||||
|
* @export
|
||||||
|
*/
|
||||||
|
export function reloadWindow(): void {
|
||||||
|
vscode.commands.executeCommand('workbench.action.reloadWindow');
|
||||||
|
}
|
33
extensions/interfaces/idefaults.ts
Normal file
33
extensions/interfaces/idefaults.ts
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
export interface IDefaults {
|
||||||
|
icons: IDefaultsThemeIcons;
|
||||||
|
themeVariants: IDefaultsThemeVariant;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IDefaultsThemeIcons {
|
||||||
|
theme: {
|
||||||
|
iconDefinitions: {
|
||||||
|
_folder_open: {
|
||||||
|
iconPath: string;
|
||||||
|
}
|
||||||
|
_folder_open_build: {
|
||||||
|
iconPath: string;
|
||||||
|
}
|
||||||
|
_folder_dark: {
|
||||||
|
iconPath: string;
|
||||||
|
}
|
||||||
|
"_file_folder-build": {
|
||||||
|
iconPath: string;
|
||||||
|
}
|
||||||
|
_file_folder: {
|
||||||
|
iconPath: string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IDefaultsThemeVariant {
|
||||||
|
Darker: string;
|
||||||
|
Default: string;
|
||||||
|
Light: string;
|
||||||
|
Palenight: string;
|
||||||
|
}
|
|
@ -23,4 +23,10 @@ export interface IPaths {
|
||||||
* @memberof IPaths
|
* @memberof IPaths
|
||||||
*/
|
*/
|
||||||
THEMES: string;
|
THEMES: string;
|
||||||
|
/**
|
||||||
|
* Extension directory
|
||||||
|
* @type {string}
|
||||||
|
* @memberof IPaths
|
||||||
|
*/
|
||||||
|
VSIX_DIR: string;
|
||||||
}
|
}
|
513
extensions/interfaces/itheme-icons.ts
Normal file
513
extensions/interfaces/itheme-icons.ts
Normal file
|
@ -0,0 +1,513 @@
|
||||||
|
export interface IThemeIconsIconPath {
|
||||||
|
iconPath: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IThemeIcons {
|
||||||
|
"iconDefinitions":
|
||||||
|
{
|
||||||
|
"_folder_dark": IThemeIconsIconPath;
|
||||||
|
"_folder_dark_build": IThemeIconsIconPath;
|
||||||
|
"_folder_light": IThemeIconsIconPath;
|
||||||
|
"_folder_light_build": IThemeIconsIconPath;
|
||||||
|
"_folder_open": IThemeIconsIconPath;
|
||||||
|
"_folder_open_build": IThemeIconsIconPath;
|
||||||
|
"_file_dark": IThemeIconsIconPath;
|
||||||
|
"_file_actionscript": IThemeIconsIconPath;
|
||||||
|
"_file_ai": IThemeIconsIconPath;
|
||||||
|
"_file_android": IThemeIconsIconPath;
|
||||||
|
"_file_angular": IThemeIconsIconPath;
|
||||||
|
"_file_applescript": IThemeIconsIconPath;
|
||||||
|
"_file_arduino": IThemeIconsIconPath;
|
||||||
|
"_file_assembly": IThemeIconsIconPath;
|
||||||
|
"_file_autohotkey": IThemeIconsIconPath;
|
||||||
|
"_file_bower": IThemeIconsIconPath;
|
||||||
|
"_file_c": IThemeIconsIconPath;
|
||||||
|
"_file_certificate": IThemeIconsIconPath;
|
||||||
|
"_file_changelog": IThemeIconsIconPath;
|
||||||
|
"_file_clojure": IThemeIconsIconPath;
|
||||||
|
"_file_cmake": IThemeIconsIconPath;
|
||||||
|
"_file_cmd": IThemeIconsIconPath;
|
||||||
|
"_file_coffee": IThemeIconsIconPath;
|
||||||
|
"_file_console": IThemeIconsIconPath;
|
||||||
|
"_file_contributing": IThemeIconsIconPath;
|
||||||
|
"_file_cpp": IThemeIconsIconPath;
|
||||||
|
"_file_credits": IThemeIconsIconPath;
|
||||||
|
"_file_csharp": IThemeIconsIconPath;
|
||||||
|
"_file_css-map": IThemeIconsIconPath;
|
||||||
|
"_file_css": IThemeIconsIconPath;
|
||||||
|
"_file_dart": IThemeIconsIconPath;
|
||||||
|
"_file_database": IThemeIconsIconPath;
|
||||||
|
"_file_dlang": IThemeIconsIconPath;
|
||||||
|
"_file_docker": IThemeIconsIconPath;
|
||||||
|
"_file_document": IThemeIconsIconPath;
|
||||||
|
"_file_email": IThemeIconsIconPath;
|
||||||
|
"_file_exe": IThemeIconsIconPath;
|
||||||
|
"_file_favicon": IThemeIconsIconPath;
|
||||||
|
"_file_file": IThemeIconsIconPath;
|
||||||
|
"_file_flash": IThemeIconsIconPath;
|
||||||
|
"_file_flow": IThemeIconsIconPath;
|
||||||
|
"_file_folder-build": IThemeIconsIconPath;
|
||||||
|
"_file_folder-light-build": IThemeIconsIconPath;
|
||||||
|
"_file_folder-light": IThemeIconsIconPath;
|
||||||
|
"_file_folder-outline-build": IThemeIconsIconPath;
|
||||||
|
"_file_folder-outline": IThemeIconsIconPath;
|
||||||
|
"_file_folder": IThemeIconsIconPath;
|
||||||
|
"_file_font": IThemeIconsIconPath;
|
||||||
|
"_file_fsharp": IThemeIconsIconPath;
|
||||||
|
"_file_git": IThemeIconsIconPath;
|
||||||
|
"_file_github": IThemeIconsIconPath;
|
||||||
|
"_file_go": IThemeIconsIconPath;
|
||||||
|
"_file_gopher": IThemeIconsIconPath;
|
||||||
|
"_file_gradle": IThemeIconsIconPath;
|
||||||
|
"_file_graphql": IThemeIconsIconPath;
|
||||||
|
"_file_groovy": IThemeIconsIconPath;
|
||||||
|
"_file_grunt": IThemeIconsIconPath;
|
||||||
|
"_file_gulp": IThemeIconsIconPath;
|
||||||
|
"_file_haml": IThemeIconsIconPath;
|
||||||
|
"_file_haskell": IThemeIconsIconPath;
|
||||||
|
"_file_html": IThemeIconsIconPath;
|
||||||
|
"_file_image": IThemeIconsIconPath;
|
||||||
|
"_file_ionic": IThemeIconsIconPath;
|
||||||
|
"_file_java": IThemeIconsIconPath;
|
||||||
|
"_file_javascript-map": IThemeIconsIconPath;
|
||||||
|
"_file_js": IThemeIconsIconPath;
|
||||||
|
"_file_json": IThemeIconsIconPath;
|
||||||
|
"_file_key": IThemeIconsIconPath;
|
||||||
|
"_file_kotlin": IThemeIconsIconPath;
|
||||||
|
"_file_less": IThemeIconsIconPath;
|
||||||
|
"_file_lib": IThemeIconsIconPath;
|
||||||
|
"_file_license": IThemeIconsIconPath;
|
||||||
|
"_file_lua": IThemeIconsIconPath;
|
||||||
|
"_file_markdown": IThemeIconsIconPath;
|
||||||
|
"_file_markup": IThemeIconsIconPath;
|
||||||
|
"_file_movie": IThemeIconsIconPath;
|
||||||
|
"_file_music": IThemeIconsIconPath;
|
||||||
|
"_file_mustache": IThemeIconsIconPath;
|
||||||
|
"_file_mxml": IThemeIconsIconPath;
|
||||||
|
"_file_nodejs": IThemeIconsIconPath;
|
||||||
|
"_file_npm": IThemeIconsIconPath;
|
||||||
|
"_file_ocaml": IThemeIconsIconPath;
|
||||||
|
"_file_pdf": IThemeIconsIconPath;
|
||||||
|
"_file_php": IThemeIconsIconPath;
|
||||||
|
"_file_polymer": IThemeIconsIconPath;
|
||||||
|
"_file_postcss": IThemeIconsIconPath;
|
||||||
|
"_file_powerpoint": IThemeIconsIconPath;
|
||||||
|
"_file_pp": IThemeIconsIconPath;
|
||||||
|
"_file_procfile": IThemeIconsIconPath;
|
||||||
|
"_file_pug": IThemeIconsIconPath;
|
||||||
|
"_file_python": IThemeIconsIconPath;
|
||||||
|
"_file_r": IThemeIconsIconPath;
|
||||||
|
"_file_rails": IThemeIconsIconPath;
|
||||||
|
"_file_raml": IThemeIconsIconPath;
|
||||||
|
"_file_react": IThemeIconsIconPath;
|
||||||
|
"_file_readme": IThemeIconsIconPath;
|
||||||
|
"_file_ruby": IThemeIconsIconPath;
|
||||||
|
"_file_rust": IThemeIconsIconPath;
|
||||||
|
"_file_sass": IThemeIconsIconPath;
|
||||||
|
"_file_settings": IThemeIconsIconPath;
|
||||||
|
"_file_sketch": IThemeIconsIconPath;
|
||||||
|
"_file_star": IThemeIconsIconPath;
|
||||||
|
"_file_stylus": IThemeIconsIconPath;
|
||||||
|
"_file_sublime": IThemeIconsIconPath;
|
||||||
|
"_file_svg": IThemeIconsIconPath;
|
||||||
|
"_file_swc": IThemeIconsIconPath;
|
||||||
|
"_file_swift": IThemeIconsIconPath;
|
||||||
|
"_file_swig": IThemeIconsIconPath;
|
||||||
|
"_file_table": IThemeIconsIconPath;
|
||||||
|
"_file_tex": IThemeIconsIconPath;
|
||||||
|
"_file_todo": IThemeIconsIconPath;
|
||||||
|
"_file_tune": IThemeIconsIconPath;
|
||||||
|
"_file_twig": IThemeIconsIconPath;
|
||||||
|
"_file_typescript": IThemeIconsIconPath;
|
||||||
|
"_file_typescript_def": IThemeIconsIconPath;
|
||||||
|
"_file_url": IThemeIconsIconPath;
|
||||||
|
"_file_virtual": IThemeIconsIconPath;
|
||||||
|
"_file_visualstudio": IThemeIconsIconPath;
|
||||||
|
"_file_vue": IThemeIconsIconPath;
|
||||||
|
"_file_webpack": IThemeIconsIconPath;
|
||||||
|
"_file_word": IThemeIconsIconPath;
|
||||||
|
"_file_xaml": IThemeIconsIconPath;
|
||||||
|
"_file_xml": IThemeIconsIconPath;
|
||||||
|
"_file_yaml": IThemeIconsIconPath;
|
||||||
|
"_file_yarn": IThemeIconsIconPath;
|
||||||
|
"_file_zip": IThemeIconsIconPath;
|
||||||
|
};
|
||||||
|
"fileExtensions":
|
||||||
|
{
|
||||||
|
"cmd": string;
|
||||||
|
"mustache": string;
|
||||||
|
"rails": string;
|
||||||
|
"styl": string;
|
||||||
|
"twig": string;
|
||||||
|
"swig": string;
|
||||||
|
"sketch": string;
|
||||||
|
"do": string;
|
||||||
|
"sublime-settings": string;
|
||||||
|
"sublime-theme": string;
|
||||||
|
"sublime-commands": string;
|
||||||
|
"sublime-menu": string;
|
||||||
|
"html": string;
|
||||||
|
"jade": string;
|
||||||
|
"pug": string;
|
||||||
|
"md": string;
|
||||||
|
"md.rendered": string;
|
||||||
|
"markdown": string;
|
||||||
|
"markdown.rendered": string;
|
||||||
|
"css": string;
|
||||||
|
"postcss": string;
|
||||||
|
"scss": string;
|
||||||
|
"sass": string;
|
||||||
|
"less": string;
|
||||||
|
"json": string;
|
||||||
|
"yaml": string;
|
||||||
|
"YAML-tmLanguage": string;
|
||||||
|
"yml": string;
|
||||||
|
"xml": string;
|
||||||
|
"plist": string;
|
||||||
|
"xsd": string;
|
||||||
|
"dtd": string;
|
||||||
|
"xsl": string;
|
||||||
|
"xslt": string;
|
||||||
|
"resx": string;
|
||||||
|
"iml": string;
|
||||||
|
"xquery": string;
|
||||||
|
"tmLanguage": string;
|
||||||
|
"png": string;
|
||||||
|
"jpeg": string;
|
||||||
|
"jpg": string;
|
||||||
|
"gif": string;
|
||||||
|
"svg": string;
|
||||||
|
"eps": string;
|
||||||
|
"ai": string;
|
||||||
|
"ico": string;
|
||||||
|
"tif": string;
|
||||||
|
"tiff": string;
|
||||||
|
"psd": string;
|
||||||
|
"psb": string;
|
||||||
|
"ami": string;
|
||||||
|
"apx": string;
|
||||||
|
"bmp": string;
|
||||||
|
"bpg": string;
|
||||||
|
"brk": string;
|
||||||
|
"cur": string;
|
||||||
|
"dds": string;
|
||||||
|
"dng": string;
|
||||||
|
"exr": string;
|
||||||
|
"fpx": string;
|
||||||
|
"gbr": string;
|
||||||
|
"img": string;
|
||||||
|
"jbig2": string;
|
||||||
|
"jb2": string;
|
||||||
|
"jng": string;
|
||||||
|
"jxr": string;
|
||||||
|
"pbm": string;
|
||||||
|
"pgf": string;
|
||||||
|
"pic": string;
|
||||||
|
"raw": string;
|
||||||
|
"webp": string;
|
||||||
|
"php": string;
|
||||||
|
"js": string;
|
||||||
|
"ejs": string;
|
||||||
|
"jsx": string;
|
||||||
|
"ini": string;
|
||||||
|
"dlc": string;
|
||||||
|
"dll": string;
|
||||||
|
"config": string;
|
||||||
|
"conf": string;
|
||||||
|
"esx": string;
|
||||||
|
"ts": string;
|
||||||
|
"tsx": string;
|
||||||
|
"d.ts": string;
|
||||||
|
"pdf": string;
|
||||||
|
"xlsx": string;
|
||||||
|
"xls": string;
|
||||||
|
"csv": string;
|
||||||
|
"vscodeignore": string;
|
||||||
|
"vsixmanifest": string;
|
||||||
|
"suo": string;
|
||||||
|
"sln": string;
|
||||||
|
"pdb": string;
|
||||||
|
"cs": string;
|
||||||
|
"csx": string;
|
||||||
|
"csproj": string;
|
||||||
|
"zip": string;
|
||||||
|
"tar": string;
|
||||||
|
"gz": string;
|
||||||
|
"xz": string;
|
||||||
|
"bzip2": string;
|
||||||
|
"gzip": string;
|
||||||
|
"7z": string;
|
||||||
|
"7zip": string;
|
||||||
|
"pzip": string;
|
||||||
|
"wim": string;
|
||||||
|
"rar": string;
|
||||||
|
"tgz": string;
|
||||||
|
"exe": string;
|
||||||
|
"msi": string;
|
||||||
|
"java": string;
|
||||||
|
"jar": string;
|
||||||
|
"jsp": string;
|
||||||
|
"c": string;
|
||||||
|
"h": string;
|
||||||
|
"m": string;
|
||||||
|
"cc": string;
|
||||||
|
"cpp": string;
|
||||||
|
"c++": string;
|
||||||
|
"hpp": string;
|
||||||
|
"mm": string;
|
||||||
|
"cxx": string;
|
||||||
|
"go": string;
|
||||||
|
"py": string;
|
||||||
|
"url": string;
|
||||||
|
"sh": string;
|
||||||
|
"bat": string;
|
||||||
|
"ps1": string;
|
||||||
|
"fish": string;
|
||||||
|
"bash": string;
|
||||||
|
"gradle": string;
|
||||||
|
"doc": string;
|
||||||
|
"docx": string;
|
||||||
|
"rtf": string;
|
||||||
|
"properties": string;
|
||||||
|
"prop": string;
|
||||||
|
"settings": string;
|
||||||
|
"sql": string;
|
||||||
|
"accdb": string;
|
||||||
|
"mdb": string;
|
||||||
|
"cer": string;
|
||||||
|
"cert": string;
|
||||||
|
"crt": string;
|
||||||
|
"pub": string;
|
||||||
|
"key": string;
|
||||||
|
"pem": string;
|
||||||
|
"asc": string;
|
||||||
|
"woff": string;
|
||||||
|
"woff2": string;
|
||||||
|
"ttf": string;
|
||||||
|
"eot": string;
|
||||||
|
"suit": string;
|
||||||
|
"otf": string;
|
||||||
|
"bmap": string;
|
||||||
|
"fnt": string;
|
||||||
|
"odttf": string;
|
||||||
|
"ttc": string;
|
||||||
|
"font": string;
|
||||||
|
"fonts": string;
|
||||||
|
"sui": string;
|
||||||
|
"ntf": string;
|
||||||
|
"mrf": string;
|
||||||
|
"lib": string;
|
||||||
|
"rb": string;
|
||||||
|
"erb": string;
|
||||||
|
"fs": string;
|
||||||
|
"fsx": string;
|
||||||
|
"fsi": string;
|
||||||
|
"fsproj": string;
|
||||||
|
"manifest": string;
|
||||||
|
"swift": string;
|
||||||
|
"ino": string;
|
||||||
|
"dockerignore": string;
|
||||||
|
"tex": string;
|
||||||
|
"bib": string;
|
||||||
|
"pptx": string;
|
||||||
|
"ppt": string;
|
||||||
|
"pptm": string;
|
||||||
|
"potx": string;
|
||||||
|
"pot": string;
|
||||||
|
"potm": string;
|
||||||
|
"ppsx": string;
|
||||||
|
"ppsm": string;
|
||||||
|
"pps": string;
|
||||||
|
"ppam": string;
|
||||||
|
"ppa": string;
|
||||||
|
"webm": string;
|
||||||
|
"mkv": string;
|
||||||
|
"flv": string;
|
||||||
|
"vob": string;
|
||||||
|
"ogv": string;
|
||||||
|
"ogg": string;
|
||||||
|
"gifv": string;
|
||||||
|
"avi": string;
|
||||||
|
"mov": string;
|
||||||
|
"qt": string;
|
||||||
|
"wmv": string;
|
||||||
|
"yuv": string;
|
||||||
|
"rm": string;
|
||||||
|
"rmvb": string;
|
||||||
|
"mp4": string;
|
||||||
|
"m4v": string;
|
||||||
|
"mpg": string;
|
||||||
|
"mp2": string;
|
||||||
|
"mpeg": string;
|
||||||
|
"mpe": string;
|
||||||
|
"mpv": string;
|
||||||
|
"m2v": string;
|
||||||
|
"vdi": string;
|
||||||
|
"vbox": string;
|
||||||
|
"vbox-prev": string;
|
||||||
|
"ics": string;
|
||||||
|
"mp3": string;
|
||||||
|
"flac": string;
|
||||||
|
"m4a": string;
|
||||||
|
"wma": string;
|
||||||
|
"aiff": string;
|
||||||
|
"coffee": string;
|
||||||
|
"txt": string;
|
||||||
|
"sqlite": string;
|
||||||
|
"graphql": string;
|
||||||
|
"gql": string;
|
||||||
|
"props": string;
|
||||||
|
"toml": string;
|
||||||
|
"rs": string;
|
||||||
|
"raml": string;
|
||||||
|
"xaml": string;
|
||||||
|
"prefs": string;
|
||||||
|
"hs": string;
|
||||||
|
"kt": string;
|
||||||
|
"project": string;
|
||||||
|
"patch": string;
|
||||||
|
"dockerfile": string;
|
||||||
|
"vb": string;
|
||||||
|
"lua": string;
|
||||||
|
"clj": string;
|
||||||
|
"groovy": string;
|
||||||
|
"r": string;
|
||||||
|
"rst": string;
|
||||||
|
"dart": string;
|
||||||
|
"as": string;
|
||||||
|
"mxml": string;
|
||||||
|
"ahk": string;
|
||||||
|
"swf": string;
|
||||||
|
"swc": string;
|
||||||
|
"cmake": string;
|
||||||
|
"asm": string;
|
||||||
|
"a51": string;
|
||||||
|
"inc": string;
|
||||||
|
"nasm": string;
|
||||||
|
"s": string;
|
||||||
|
"ms": string;
|
||||||
|
"agc": string;
|
||||||
|
"ags": string;
|
||||||
|
"aea": string;
|
||||||
|
"argus": string;
|
||||||
|
"mitigus": string;
|
||||||
|
"binsource": string;
|
||||||
|
"vue": string;
|
||||||
|
"ml": string;
|
||||||
|
"mli": string;
|
||||||
|
"cmx": string;
|
||||||
|
"js.map": string;
|
||||||
|
"css.map": string;
|
||||||
|
"tmTheme": string;
|
||||||
|
"pp": string;
|
||||||
|
"applescript": string;
|
||||||
|
"haml": string };
|
||||||
|
"fileNames":
|
||||||
|
{ "gruntfile.js": string;
|
||||||
|
"bower.json": string;
|
||||||
|
".bowerrc": string;
|
||||||
|
"webpack.js": string;
|
||||||
|
"webpack.config.js": string;
|
||||||
|
"webpack.dev.js": string;
|
||||||
|
"webpack.prod.js": string;
|
||||||
|
"webpack.common.js": string;
|
||||||
|
"webpackfile.js": string;
|
||||||
|
"ionic.config.json": string;
|
||||||
|
".io-config.json": string;
|
||||||
|
"gulpfile.js": string;
|
||||||
|
"gulpfile.babel.js": string;
|
||||||
|
"package.json": string;
|
||||||
|
"gradle.properties": string;
|
||||||
|
"gradlew": string;
|
||||||
|
".jscsrc": string;
|
||||||
|
".jshintrc": string;
|
||||||
|
".jshintignore": string;
|
||||||
|
".npmignore": string;
|
||||||
|
"tsconfig.json": string;
|
||||||
|
"tslint.json": string;
|
||||||
|
"androidmanifest.xml": string;
|
||||||
|
"gradle-wrapper.properties": string;
|
||||||
|
".editorconfig": string;
|
||||||
|
"procfile": string;
|
||||||
|
".env": string;
|
||||||
|
"dockerfile": string;
|
||||||
|
"license": string;
|
||||||
|
"license.md": string;
|
||||||
|
"license.md.rendered": string;
|
||||||
|
"license.txt": string;
|
||||||
|
".babelrc": string;
|
||||||
|
".eslintrc": string;
|
||||||
|
".buildignore": string;
|
||||||
|
".htaccess": string;
|
||||||
|
"composer.lock": string;
|
||||||
|
".gitignore": string;
|
||||||
|
".gitconfig": string;
|
||||||
|
".gitattributes": string;
|
||||||
|
".gitmodules": string;
|
||||||
|
".gitkeep": string;
|
||||||
|
"yarn.lock": string;
|
||||||
|
".yarnclean": string;
|
||||||
|
".yarn-integrity": string;
|
||||||
|
"yarn-error.log": string;
|
||||||
|
"contributing.md": string;
|
||||||
|
"contributing.md.rendered": string;
|
||||||
|
"readme.md": string;
|
||||||
|
"readme.md.rendered": string;
|
||||||
|
".mailmap": string;
|
||||||
|
"makefile": string;
|
||||||
|
"changelog": string;
|
||||||
|
"changelog.md": string;
|
||||||
|
"changelog.md.rendered": string;
|
||||||
|
"CREDITS": string;
|
||||||
|
"credits.txt": string;
|
||||||
|
"credits.md": string;
|
||||||
|
"credits.md.rendered": string;
|
||||||
|
".flowconfig": string;
|
||||||
|
".jsbeautifyrc": string;
|
||||||
|
"git-history": string;
|
||||||
|
"angular-cli.json": string;
|
||||||
|
"app.module.ts": string;
|
||||||
|
"favicon.ico": string };
|
||||||
|
"file": string;
|
||||||
|
"folder": string;
|
||||||
|
"folderExpanded": string;
|
||||||
|
"languageIds":
|
||||||
|
{ "git": string };
|
||||||
|
"light":
|
||||||
|
{
|
||||||
|
"folderExpanded": string;
|
||||||
|
"folder": string;
|
||||||
|
"folderNames":
|
||||||
|
{ "node_modules": string;
|
||||||
|
".git": string;
|
||||||
|
".github": string;
|
||||||
|
".gulp": string;
|
||||||
|
"bower_components": string;
|
||||||
|
"build": string;
|
||||||
|
"dist": string };
|
||||||
|
"folderNamesExpanded":
|
||||||
|
{ "node_modules": string;
|
||||||
|
".git": string;
|
||||||
|
".github": string;
|
||||||
|
".gulp": string;
|
||||||
|
"bower_components": string;
|
||||||
|
"build": string;
|
||||||
|
"dist": string }
|
||||||
|
};
|
||||||
|
"folderNames":
|
||||||
|
{ "node_modules": string;
|
||||||
|
".git": string;
|
||||||
|
".github": string;
|
||||||
|
".gulp": string;
|
||||||
|
"bower_components": string;
|
||||||
|
"build": string;
|
||||||
|
"dist": string };
|
||||||
|
"folderNamesExpanded":
|
||||||
|
{ "node_modules": string;
|
||||||
|
".git": string;
|
||||||
|
".github": string;
|
||||||
|
".gulp": string;
|
||||||
|
"bower_components": string;
|
||||||
|
"build": string;
|
||||||
|
"dist": string }
|
||||||
|
}
|
|
@ -1,7 +1,8 @@
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
|
|
||||||
import { IGenericObject } from "./interfaces/igeneric-object";
|
import { IGenericObject } from "./interfaces/igeneric-object";
|
||||||
import { THEME_ACCENTS_SETTER } from "./accents-setter/index";
|
import { THEME_ACCENTS_SETTER } from "./commands/accents-setter/index";
|
||||||
|
import { THEME_CHANGE_LISTENER } from "./commands/theme-icons/index";
|
||||||
|
|
||||||
enum Commands {
|
enum Commands {
|
||||||
ACCENTS,
|
ACCENTS,
|
||||||
|
@ -25,5 +26,8 @@ export function activate(context: vscode.ExtensionContext) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
THEME_CHANGE_LISTENER();
|
||||||
|
|
||||||
context.subscriptions.push(command);
|
context.subscriptions.push(command);
|
||||||
}
|
}
|
||||||
|
|
96
package.json
96
package.json
|
@ -42,7 +42,7 @@
|
||||||
"Other"
|
"Other"
|
||||||
],
|
],
|
||||||
"activationEvents": [
|
"activationEvents": [
|
||||||
"onCommand:material.theme.config"
|
"*"
|
||||||
],
|
],
|
||||||
"main": "./extensions/material.theme.config",
|
"main": "./extensions/material.theme.config",
|
||||||
"contributes": {
|
"contributes": {
|
||||||
|
@ -55,17 +55,17 @@
|
||||||
],
|
],
|
||||||
"configuration": {
|
"configuration": {
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"materialTheme.cache.workbench.accent": {
|
||||||
|
"default": "",
|
||||||
|
"type": "string",
|
||||||
|
"title": "Accent selected",
|
||||||
|
"description": "Theme's current accent."
|
||||||
|
},
|
||||||
"materialTheme.cache.workbench.colorCustomizations": {
|
"materialTheme.cache.workbench.colorCustomizations": {
|
||||||
"default": {},
|
"default": {},
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"title": "Previous color customizations",
|
"title": "Previous color customizations",
|
||||||
"description": "Keeps in cache your previous color customizations."
|
"description": "Keeps in cache your previous color customizations."
|
||||||
},
|
|
||||||
"materialTheme.cache.workbench.iconTheme": {
|
|
||||||
"default": "",
|
|
||||||
"type": "string",
|
|
||||||
"title": "Previous icon theme",
|
|
||||||
"description": "Keeps in cache your previous icon theme."
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -93,89 +93,9 @@
|
||||||
],
|
],
|
||||||
"iconThemes": [
|
"iconThemes": [
|
||||||
{
|
{
|
||||||
"id": "material-theme-icons",
|
"id": "eq-material-theme-icons",
|
||||||
"label": "Material Theme Icons",
|
"label": "Material Theme Icons",
|
||||||
"path": "./themes/Material-Theme-Icons.json"
|
"path": "./themes/Material-Theme-Icons.json"
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "material-theme-icons-acid-lime",
|
|
||||||
"label": "Material Theme Icons - Acid Lime accent",
|
|
||||||
"path": "./themes/Material-Theme-Icons-Acid Lime.json"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "material-theme-icons-blue",
|
|
||||||
"label": "Material Theme Icons - Blue accent",
|
|
||||||
"path": "./themes/Material-Theme-Icons-Blue.json"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "material-theme-icons-breaking-bad",
|
|
||||||
"label": "Material Theme Icons - Breaking Bad accent",
|
|
||||||
"path": "./themes/Material-Theme-Icons-Breaking Bad.json"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "material-theme-icons-bright-teal",
|
|
||||||
"label": "Material Theme Icons - Bright Teal accent",
|
|
||||||
"path": "./themes/Material-Theme-Icons-Bright Teal.json"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "material-theme-icons-cyan",
|
|
||||||
"label": "Material Theme Icons - Cyan accent",
|
|
||||||
"path": "./themes/Material-Theme-Icons-Cyan.json"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "material-theme-icons-graphite",
|
|
||||||
"label": "Material Theme Icons - Graphite accent",
|
|
||||||
"path": "./themes/Material-Theme-Icons-Graphite.json"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "material-theme-icons-indigo",
|
|
||||||
"label": "Material Theme Icons - Indigo accent",
|
|
||||||
"path": "./themes/Material-Theme-Icons-Indigo.json"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "material-theme-icons-lime",
|
|
||||||
"label": "Material Theme Icons - Lime accent",
|
|
||||||
"path": "./themes/Material-Theme-Icons-Lime.json"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "material-theme-icons-orange",
|
|
||||||
"label": "Material Theme Icons - Orange accent",
|
|
||||||
"path": "./themes/Material-Theme-Icons-Orange.json"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "material-theme-icons-pink",
|
|
||||||
"label": "Material Theme Icons - Pink accent",
|
|
||||||
"path": "./themes/Material-Theme-Icons-Pink.json"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "material-theme-icons-purple",
|
|
||||||
"label": "Material Theme Icons - Purple accent",
|
|
||||||
"path": "./themes/Material-Theme-Icons-Purple.json"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "material-theme-icons-red",
|
|
||||||
"label": "Material Theme Icons - Red accent",
|
|
||||||
"path": "./themes/Material-Theme-Icons-Red.json"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "material-theme-icons-sky",
|
|
||||||
"label": "Material Theme Icons - Sky accent",
|
|
||||||
"path": "./themes/Material-Theme-Icons-Sky.json"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "material-theme-icons-tomato",
|
|
||||||
"label": "Material Theme Icons - Tomato accent",
|
|
||||||
"path": "./themes/Material-Theme-Icons-Tomato.json"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "material-theme-icons-teal",
|
|
||||||
"label": "Material Theme Icons - Teal accent",
|
|
||||||
"path": "./themes/Material-Theme-Icons-Teal.json"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "material-theme-icons-yellow",
|
|
||||||
"label": "Material Theme Icons - Yellow accent",
|
|
||||||
"path": "./themes/Material-Theme-Icons-Yellow.json"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue