Merge branch 'refactor-icon-build-system' into develop
|
@ -1,4 +1,10 @@
|
||||||
export interface IIcon {
|
export interface IIcon {
|
||||||
|
/**
|
||||||
|
* Icon filename
|
||||||
|
* @type {string}
|
||||||
|
* @memberof IIcon
|
||||||
|
*/
|
||||||
|
filename: string;
|
||||||
/**
|
/**
|
||||||
* If set to true, the icon is marked as last
|
* If set to true, the icon is marked as last
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
|
|
|
@ -3,8 +3,9 @@ import { IThemeIconsItem } from "./itheme-icons-item";
|
||||||
export interface IThemeIconsVariants {
|
export interface IThemeIconsVariants {
|
||||||
iconDefinitions: {
|
iconDefinitions: {
|
||||||
"_folder_dark": IThemeIconsItem;
|
"_folder_dark": IThemeIconsItem;
|
||||||
"_folder_dark-build": IThemeIconsItem;
|
"_folder_dark_build": IThemeIconsItem;
|
||||||
"_file_folder": IThemeIconsItem;
|
"_folder_light": IThemeIconsItem;
|
||||||
"_file_folder-build": IThemeIconsItem;
|
"_folder_light_build": IThemeIconsItem;
|
||||||
|
"_folder_vscode": IThemeIconsItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -9,19 +9,11 @@ import { CHARSET } from "../../extensions/consts/files";
|
||||||
import { IDefaults } from "../../extensions/interfaces/idefaults";
|
import { IDefaults } from "../../extensions/interfaces/idefaults";
|
||||||
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'
|
||||||
|
import { IThemeIconsItem } from '../interfaces/itheme-icons-item';
|
||||||
// import { IPackageJSON } from "../../extensions/interfaces/ipackage.json";
|
import { getAccentableIcons } from '../../extensions/helpers/fs';
|
||||||
// import { writePackageJSON } from "../helpers/contribute-icon-theme";
|
|
||||||
|
|
||||||
const BASE_ICON_THEME_PATH: string = path.join(process.cwd(), PATHS.THEMES, './Material-Theme-Icons.json');
|
const BASE_ICON_THEME_PATH: string = path.join(process.cwd(), PATHS.THEMES, './Material-Theme-Icons.json');
|
||||||
const DEFAULTS: IDefaults = require('../../extensions/defaults.json');
|
const DEFAULTS: IDefaults = require('../../extensions/defaults.json');
|
||||||
// const PACKAGE_JSON: IPackageJSON = require('../../package.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
|
||||||
|
@ -50,13 +42,17 @@ function replaceNameWithAccent(name: string, accentName: string): string {
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
export function replaceSVGColour(filecontent: string, colour: string): string {
|
export function replaceSVGColour(filecontent: string, colour: string): string {
|
||||||
return filecontent.replace(new RegExp('.st0\{fill:#([a-zA-Z0-9]{6})\}|path fill="#([a-zA-Z0-9]{6})"'), ($0, $1, $2) => {
|
return filecontent.replace(new RegExp('.st0\{fill:\s{0,}#([a-zA-Z0-9]{6})|path fill="#([a-zA-Z0-9]{6})"'), ($0, $1, $2) => {
|
||||||
|
|
||||||
colour = colour.replace('#', '');
|
colour = colour.replace('#', '');
|
||||||
|
|
||||||
if (!$2) {
|
if (!$2) {
|
||||||
|
console.log(`Replacing colour ${ $1 } with ${ colour }`)
|
||||||
|
|
||||||
return $0.replace($1, colour);
|
return $0.replace($1, colour);
|
||||||
} else {
|
} else {
|
||||||
|
console.log(`Replacing colour ${ $2 } with ${ colour }`)
|
||||||
|
|
||||||
return $0.replace($2, colour);
|
return $0.replace($2, colour);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -82,6 +78,8 @@ function writeSVGIcon(fromFile: string, toFile: string, accent: string): void {
|
||||||
let content: string = replaceSVGColour(fileContent, DEFAULTS.accents[accent]);
|
let content: string = replaceSVGColour(fileContent, DEFAULTS.accents[accent]);
|
||||||
toFile = normalizeIconPath(toFile);
|
toFile = normalizeIconPath(toFile);
|
||||||
|
|
||||||
|
gutil.log(gutil.colors.gray(`Accented icon ${toFile} created with colour ${ accent } (${ DEFAULTS.accents[accent] })`));
|
||||||
|
|
||||||
fs.writeFileSync(toFile, content);
|
fs.writeFileSync(toFile, content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,8 +87,6 @@ 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 ];
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
basetheme = require(BASE_ICON_THEME_PATH);
|
basetheme = require(BASE_ICON_THEME_PATH);
|
||||||
|
|
||||||
|
@ -99,15 +95,25 @@ 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() }`;
|
getAccentableIcons().forEach(accentableIconName => {
|
||||||
// let label: string = `${ PACKAGE_JSON_ICON_THEME.label } - ${ key } accent`;
|
gutil.log(gutil.colors.gray(`Preparing ${ accentableIconName } accented icon`));
|
||||||
// let themepathJSON: string = `./${ themePath }`;
|
|
||||||
|
|
||||||
themecopy.iconDefinitions._folder_open.iconPath = replaceNameWithAccent(basetheme.iconDefinitions._folder_open.iconPath, iconName);
|
let iconOriginDefinition: IThemeIconsItem = (basetheme.iconDefinitions as any)[accentableIconName];
|
||||||
themecopy.iconDefinitions._folder_open_build.iconPath = replaceNameWithAccent(basetheme.iconDefinitions._folder_open_build.iconPath, iconName);
|
let iconCopyDefinition: IThemeIconsItem = (themecopy.iconDefinitions as any)[accentableIconName];
|
||||||
|
|
||||||
writeSVGIcon(basetheme.iconDefinitions._folder_open.iconPath, themecopy.iconDefinitions._folder_open.iconPath, key);
|
if (iconOriginDefinition !== undefined && typeof iconOriginDefinition.iconPath === 'string' && iconCopyDefinition !== undefined && typeof iconCopyDefinition.iconPath === 'string') {
|
||||||
writeSVGIcon(basetheme.iconDefinitions._folder_open_build.iconPath, themecopy.iconDefinitions._folder_open_build.iconPath, key);
|
iconCopyDefinition.iconPath = replaceNameWithAccent(iconOriginDefinition.iconPath, iconName);
|
||||||
|
writeSVGIcon(iconOriginDefinition.iconPath, iconCopyDefinition.iconPath, key);
|
||||||
|
} else {
|
||||||
|
gutil.log(gutil.colors.yellow(`Icon ${ accentableIconName } not found`))
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
|
||||||
// fs.writeFileSync(themePath, JSON.stringify(themecopy));
|
// fs.writeFileSync(themePath, JSON.stringify(themecopy));
|
||||||
|
|
||||||
|
|
|
@ -36,12 +36,18 @@ export default gulp.task('build:icons.variants', callback => {
|
||||||
let variant = variants[variantName];
|
let variant = variants[variantName];
|
||||||
|
|
||||||
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._folder_dark_build.iconPath = theme.iconDefinitions._folder_dark_build.iconPath.replace('.svg', `${ variantName }.svg`);
|
||||||
theme.iconDefinitions["_file_folder-build"].iconPath = theme.iconDefinitions["_file_folder-build"].iconPath.replace('.svg', `${ variantName }.svg`);
|
theme.iconDefinitions._folder_vscode.iconPath = theme.iconDefinitions._folder_vscode.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._folder_light.iconPath = theme.iconDefinitions._folder_light.iconPath.replace('.svg', `${ variantName }.svg`);
|
||||||
|
theme.iconDefinitions["_folder_light_build"].iconPath = theme.iconDefinitions["_folder_light_build"].iconPath.replace('.svg', `${ variantName }.svg`);
|
||||||
|
|
||||||
writeIconVariant(basetheme.iconDefinitions._folder_dark.iconPath, theme.iconDefinitions._folder_dark.iconPath, variant);
|
writeIconVariant(basetheme.iconDefinitions._folder_dark.iconPath, theme.iconDefinitions._folder_dark.iconPath, variant);
|
||||||
writeIconVariant(basetheme.iconDefinitions._file_folder.iconPath, theme.iconDefinitions._file_folder.iconPath, variant);
|
writeIconVariant(basetheme.iconDefinitions._folder_dark_build.iconPath, theme.iconDefinitions._folder_dark_build.iconPath, variant);
|
||||||
writeIconVariant(basetheme.iconDefinitions["_file_folder-build"].iconPath, theme.iconDefinitions["_file_folder-build"].iconPath, variant);
|
writeIconVariant(basetheme.iconDefinitions._folder_light.iconPath, theme.iconDefinitions._folder_light.iconPath, variant);
|
||||||
|
writeIconVariant(basetheme.iconDefinitions._folder_vscode.iconPath, theme.iconDefinitions._folder_vscode.iconPath, variant);
|
||||||
|
writeIconVariant(basetheme.iconDefinitions["_folder_light_build"].iconPath, theme.iconDefinitions["_folder_light_build"].iconPath, variant);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ import { CHARSET } from "../../extensions/consts/files";
|
||||||
import { IGenericObject } from "../../extensions/interfaces/igeneric-object";
|
import { IGenericObject } from "../../extensions/interfaces/igeneric-object";
|
||||||
import { IIcon } from './../interfaces/iicon';
|
import { IIcon } from './../interfaces/iicon';
|
||||||
import paths from '../../extensions/consts/paths';
|
import paths from '../../extensions/consts/paths';
|
||||||
|
import { ensureDir } from '../../extensions/helpers/fs';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an object implementing the IIcon interface
|
* Returns an object implementing the IIcon interface
|
||||||
|
@ -17,10 +18,24 @@ import paths from '../../extensions/consts/paths';
|
||||||
* @returns {IIcon}
|
* @returns {IIcon}
|
||||||
*/
|
*/
|
||||||
function iconFactory(fileName: string): IIcon {
|
function iconFactory(fileName: string): IIcon {
|
||||||
|
gutil.log(gutil.colors.gray(`Processing icon ${ fileName }`))
|
||||||
let name: string = path.basename(fileName, path.extname(fileName));
|
let name: string = path.basename(fileName, path.extname(fileName));
|
||||||
|
let filename: string = name;
|
||||||
let last: boolean = false;
|
let last: boolean = false;
|
||||||
|
|
||||||
return { name, last } as IIcon;
|
// renaming icon for vscode
|
||||||
|
// if the icon filename starts with a folder prefix,
|
||||||
|
// the resulting name will be prefixed only by an underscore,
|
||||||
|
// otherwise the icon will be prefixed by a _file_ prefix
|
||||||
|
if (name.indexOf('folder')) {
|
||||||
|
name = name.indexOf('file') ? `_file_${ name }` : `_${ name }`;
|
||||||
|
} else {
|
||||||
|
name = `_${ name }`;
|
||||||
|
}
|
||||||
|
|
||||||
|
gutil.log(gutil.colors.gray(`VSCode icon name ${ name } with filename ${ filename }`));
|
||||||
|
|
||||||
|
return { filename, name, last } as IIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,6 +50,8 @@ export default gulp.task('build:icons', cb => {
|
||||||
let partialsData: IGenericObject<any> = {};
|
let partialsData: IGenericObject<any> = {};
|
||||||
let pathTemp: string = './themes/.material-theme-icons.tmp';
|
let pathTemp: string = './themes/.material-theme-icons.tmp';
|
||||||
|
|
||||||
|
ensureDir(path.join(paths.THEMES));
|
||||||
|
|
||||||
icons[icons.length - 1].last = true;
|
icons[icons.length - 1].last = true;
|
||||||
|
|
||||||
partials.forEach(partial => {
|
partials.forEach(partial => {
|
||||||
|
|
|
@ -10,6 +10,7 @@ import { CHARSET } from "../../extensions/consts/files";
|
||||||
import { IDefaults } from "../../extensions/interfaces/idefaults";
|
import { IDefaults } from "../../extensions/interfaces/idefaults";
|
||||||
import { IThemeVariant } from './../interfaces/itheme-variant';
|
import { IThemeVariant } from './../interfaces/itheme-variant';
|
||||||
import paths from '../../extensions/consts/paths';
|
import paths from '../../extensions/consts/paths';
|
||||||
|
import { ensureDir } from '../../extensions/helpers/fs';
|
||||||
|
|
||||||
let commons: IDefaults = require('../../extensions/defaults.json');
|
let commons: IDefaults = require('../../extensions/defaults.json');
|
||||||
|
|
||||||
|
@ -34,9 +35,12 @@ fileNames.forEach(fileName => {
|
||||||
* Themes task
|
* Themes task
|
||||||
* Builds Themes
|
* Builds Themes
|
||||||
*/
|
*/
|
||||||
export default gulp.task('build:themes', () => {
|
export default gulp.task('build:themes', cb => {
|
||||||
gulpUtil.log(gulpUtil.colors.gray(HR));
|
gulpUtil.log(gulpUtil.colors.gray(HR));
|
||||||
|
|
||||||
|
ensureDir(path.join(paths.THEMES));
|
||||||
|
|
||||||
|
try {
|
||||||
themeVariants.forEach(variant => {
|
themeVariants.forEach(variant => {
|
||||||
let filePath = path.join(paths.THEMES, `./${variant.name}.json`);
|
let filePath = path.join(paths.THEMES, `./${variant.name}.json`);
|
||||||
let templateData = { commons, variant };
|
let templateData = { commons, variant };
|
||||||
|
@ -47,6 +51,10 @@ export default gulp.task('build:themes', () => {
|
||||||
|
|
||||||
gulpUtil.log(MESSAGE_GENERATED, gulpUtil.colors.green(filePath));
|
gulpUtil.log(MESSAGE_GENERATED, gulpUtil.colors.green(filePath));
|
||||||
});
|
});
|
||||||
|
} catch (exception) {
|
||||||
|
gulpUtil.log(exception);
|
||||||
|
cb(exception);
|
||||||
|
}
|
||||||
|
|
||||||
gulpUtil.log(gulpUtil.colors.gray(HR));
|
gulpUtil.log(gulpUtil.colors.gray(HR));
|
||||||
});
|
});
|
||||||
|
|
43
CONTRIBUTING.md
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
Contributing guidelines
|
||||||
|
=======================
|
||||||
|
|
||||||
|
> Note: this document is intended as a draft, it will be updated soon
|
||||||
|
|
||||||
|
### Requirements:
|
||||||
|
|
||||||
|
* Nodejs ^6.x
|
||||||
|
* Visual Studio Code
|
||||||
|
|
||||||
|
### Installing and compiling source
|
||||||
|
|
||||||
|
First you will have to install node_modules through npm or yarn
|
||||||
|
|
||||||
|
```shell
|
||||||
|
npm install
|
||||||
|
# or
|
||||||
|
yarn install
|
||||||
|
```
|
||||||
|
|
||||||
|
To compile to the source code, you have to execute the build task through visual studio code.
|
||||||
|
First you need to invoke to quick command (on MacOS `⌘P`, while on Linux/windows is `ctrl+p`)
|
||||||
|
then type `task build` and wait until vsc will have finished the task.
|
||||||
|
|
||||||
|
### Testing the theme
|
||||||
|
|
||||||
|
To test the theme, you will have to go to the debug section, select the *Launch Extension* from debug and execute it.
|
||||||
|
|
||||||
|
### Adding new Material Theme commands
|
||||||
|
|
||||||
|
Soon(ish)®
|
||||||
|
|
||||||
|
### Adding new icons
|
||||||
|
|
||||||
|
* Add your icon to the `~/src/icons/svgs` directory.
|
||||||
|
|
||||||
|
* Add the reference to that icon to the `~/src/icons/partials/fileNames.js` or if your icon is referred to a directory adds the reference to the `~/src/icons/partials/folderNames.js` file, otherwise to `~/src/icons/partials/fileExtensions.js` if is referred to a file extension.
|
||||||
|
|
||||||
|
* If you want to make the icon sensitive to be accented, modify the `~/extensions/defaults.json` file, adding the icon definition to the `accentableIcons` array (e.g. ["_folder_open", "_folder_open_build"]) and the path to the `icons.theme.iconDefinitions` object. The same applies to variants (the variant icons array is called "variantsIcons")
|
||||||
|
|
||||||
|
* Execute the build command.
|
||||||
|
|
||||||
|
* Enjoy your new icons in Material Theme, and don't forget to pull request!
|
|
@ -99,11 +99,11 @@ function setWorkbenchOptions(accentSelected: string | undefined, config: any): v
|
||||||
let themeID = getCurrentThemeID()
|
let themeID = getCurrentThemeID()
|
||||||
let themeIconsID = getCurrentThemeIconsID()
|
let themeIconsID = getCurrentThemeIconsID()
|
||||||
|
|
||||||
updateAccent(accentSelected);
|
updateAccent(accentSelected).then(() => {
|
||||||
|
|
||||||
if (isMaterialTheme(themeID) && isMaterialThemeIcons(themeIconsID)) {
|
if (isMaterialTheme(themeID) && isMaterialThemeIcons(themeIconsID)) {
|
||||||
THEME_ICONS().then(() => reloadWindow());
|
THEME_ICONS().then(() => reloadWindow());
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}, reason => {
|
}, reason => {
|
||||||
vscode.window.showErrorMessage(reason);
|
vscode.window.showErrorMessage(reason);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,12 +1,28 @@
|
||||||
|
import {getAccentableIcons} from '../../helpers/fs';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
|
|
||||||
import { getAbsolutePath, getDefaultValues, getThemeIconsByContributeID, getThemeIconsContribute } from "../../helpers/fs";
|
import { getAbsolutePath, getDefaultValues, getThemeIconsByContributeID, getThemeIconsContribute, getVariantIcons } from "../../helpers/fs";
|
||||||
import { getCurrentThemeIconsID } from "../../helpers/vscode";
|
import { getCurrentThemeIconsID } from "../../helpers/vscode";
|
||||||
import { getCustomSettings, isAccent, isMaterialThemeIcons } from "../../helpers/settings";
|
import { getCustomSettings, isAccent, isMaterialThemeIcons } from "../../helpers/settings";
|
||||||
|
|
||||||
import { CHARSET } from "../../consts/files";
|
import { CHARSET } from "../../consts/files";
|
||||||
import { IPackageJSONThemeIcons } from "../../interfaces/ipackage.json";
|
import { IPackageJSONThemeIcons } from "../../interfaces/ipackage.json";
|
||||||
import { IThemeIcons } from "../../interfaces/itheme-icons";
|
import {IThemeIconsIconPath, IThemeIcons} from '../../interfaces/itheme-icons';
|
||||||
|
|
||||||
|
|
||||||
|
function getIconDefinition(definitions: any, iconname: string): IThemeIconsIconPath {
|
||||||
|
return (definitions as any)[iconname];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replaces icon path with the accented one.
|
||||||
|
* @param {string} iconPath
|
||||||
|
* @param {string} accentName
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
function replaceIconPathWithAccent(iconPath: string, accentName: string): string {
|
||||||
|
return iconPath.replace('.svg', `.accent.${ accentName }.svg`);
|
||||||
|
}
|
||||||
|
|
||||||
export const THEME_ICONS = () => {
|
export const THEME_ICONS = () => {
|
||||||
let deferred: any = {};
|
let deferred: any = {};
|
||||||
|
@ -27,17 +43,44 @@ export const THEME_ICONS = () => {
|
||||||
|
|
||||||
if (isAccent(accentName, defaults)) {
|
if (isAccent(accentName, defaults)) {
|
||||||
let _accentName = accentName.replace(/\s+/, '-');
|
let _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`);
|
getAccentableIcons().forEach(iconname => {
|
||||||
|
let distIcon = getIconDefinition(theme.iconDefinitions, iconname);
|
||||||
|
let outIcon = getIconDefinition(defaults.icons.theme.iconDefinitions, iconname);
|
||||||
|
|
||||||
|
if (typeof distIcon === 'object' && typeof outIcon === 'object') {
|
||||||
|
distIcon.iconPath = replaceIconPathWithAccent(outIcon.iconPath, _accentName)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// 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 {
|
} 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;
|
getAccentableIcons().forEach(iconname => {
|
||||||
|
let distIcon = getIconDefinition(theme.iconDefinitions, iconname);
|
||||||
|
let outIcon = getIconDefinition(defaults.icons.theme.iconDefinitions, iconname);
|
||||||
|
|
||||||
|
distIcon.iconPath = outIcon.iconPath;
|
||||||
|
});
|
||||||
|
// 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
theme.iconDefinitions._folder_dark.iconPath = defaults.icons.theme.iconDefinitions._folder_dark.iconPath.replace('.svg', `${ variantName }.svg`);
|
getVariantIcons().forEach(iconname => {
|
||||||
theme.iconDefinitions._file_folder.iconPath = defaults.icons.theme.iconDefinitions._file_folder.iconPath.replace('.svg', `${ variantName }.svg`);
|
let distIcon = getIconDefinition(theme.iconDefinitions, iconname);
|
||||||
theme.iconDefinitions._folder_dark_build.iconPath = defaults.icons.theme.iconDefinitions._folder_dark_build.iconPath.replace('.svg', `${ variantName }.svg`);
|
let outIcon = getIconDefinition(defaults.icons.theme.iconDefinitions, iconname);
|
||||||
theme.iconDefinitions["_file_folder-build"].iconPath = defaults.icons.theme.iconDefinitions["_file_folder-build"].iconPath.replace('.svg', `${ variantName }.svg`);
|
|
||||||
|
if (!!distIcon && !!outIcon) {
|
||||||
|
distIcon.iconPath = outIcon.iconPath.replace('.svg', `${ variantName }.svg`);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// theme.iconDefinitions._folder_dark.iconPath = defaults.icons.theme.iconDefinitions._folder_dark.iconPath.replace('.svg', `${ variantName }.svg`);
|
||||||
|
// theme.iconDefinitions._folder_dark_build.iconPath = defaults.icons.theme.iconDefinitions._folder_dark_build.iconPath.replace('.svg', `${ variantName }.svg`);
|
||||||
|
|
||||||
|
// theme.iconDefinitions._folder_light.iconPath = defaults.icons.theme.iconDefinitions._folder_light.iconPath.replace('.svg', `${ variantName }.svg`);
|
||||||
|
// theme.iconDefinitions["_folder_light_build"].iconPath = defaults.icons.theme.iconDefinitions["_folder_light_build"].iconPath.replace('.svg', `${ variantName }.svg`);
|
||||||
|
|
||||||
fs.writeFile(themepath, JSON.stringify(theme), { encoding: CHARSET }, (error) => {
|
fs.writeFile(themepath, JSON.stringify(theme), { encoding: CHARSET }, (error) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
|
|
|
@ -17,29 +17,46 @@
|
||||||
"Teal": "#80CBC4",
|
"Teal": "#80CBC4",
|
||||||
"Yellow": "#FFA000"
|
"Yellow": "#FFA000"
|
||||||
},
|
},
|
||||||
|
"accentableIcons": [
|
||||||
|
"_folder_open",
|
||||||
|
"_folder_open_build",
|
||||||
|
"_folder_vscode_open"
|
||||||
|
],
|
||||||
"changelog": {
|
"changelog": {
|
||||||
"lastversion": "1.0.5"
|
"lastversion": "1.0.5"
|
||||||
},
|
},
|
||||||
"icons": {
|
"icons": {
|
||||||
"theme": {
|
"theme": {
|
||||||
"iconDefinitions": {
|
"iconDefinitions": {
|
||||||
"_folder_dark": {
|
"_folder_vscode": {
|
||||||
"iconPath": "../icons/folder.svg"
|
"iconPath": "../icons/folder_vscode.svg"
|
||||||
},
|
},
|
||||||
"_file_folder": {
|
"_folder_vscode_open": {
|
||||||
"iconPath": "../icons/folder.svg"
|
"iconPath": "../icons/folder_vscode_open.svg"
|
||||||
|
},
|
||||||
|
"_folder_dark": {
|
||||||
|
"iconPath": "../icons/folder_dark.svg"
|
||||||
},
|
},
|
||||||
"_folder_dark_build": {
|
"_folder_dark_build": {
|
||||||
"iconPath": "../icons/folder-build.svg"
|
"iconPath": "../icons/folder_dark_build.svg"
|
||||||
},
|
},
|
||||||
"_file_folder-build": {
|
"_folder_light": {
|
||||||
"iconPath": "../icons/folder-build.svg"
|
"iconPath": "../icons/folder_light.svg"
|
||||||
|
},
|
||||||
|
"_folder_light_build": {
|
||||||
|
"iconPath": "../icons/folder_light_build.svg"
|
||||||
|
},
|
||||||
|
"_file_folder": {
|
||||||
|
"iconPath": "../icons/file_folder.svg"
|
||||||
|
},
|
||||||
|
"_file_folder_build": {
|
||||||
|
"iconPath": "../icons/file_folder_build.svg"
|
||||||
},
|
},
|
||||||
"_folder_open": {
|
"_folder_open": {
|
||||||
"iconPath": "../icons/folder-outline.svg"
|
"iconPath": "../icons/folder_open.svg"
|
||||||
},
|
},
|
||||||
"_folder_open_build": {
|
"_folder_open_build": {
|
||||||
"iconPath": "../icons/folder-outline-build.svg"
|
"iconPath": "../icons/folder_open_build.svg"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,5 +90,12 @@
|
||||||
"Light High Contrast": "vs",
|
"Light High Contrast": "vs",
|
||||||
"Palenight": "vs-dark",
|
"Palenight": "vs-dark",
|
||||||
"Palenight High Contrast": "vs-dark"
|
"Palenight High Contrast": "vs-dark"
|
||||||
}
|
},
|
||||||
|
"variantsIcons": [
|
||||||
|
"_folder_dark_build",
|
||||||
|
"_folder_dark",
|
||||||
|
"_folder_light_build",
|
||||||
|
"_folder_light",
|
||||||
|
"_folder_vscode"
|
||||||
|
]
|
||||||
}
|
}
|
|
@ -8,6 +8,16 @@ import { IDefaults } from "../interfaces/idefaults";
|
||||||
import { IThemeIcons } from "../interfaces/itheme-icons";
|
import { IThemeIcons } from "../interfaces/itheme-icons";
|
||||||
import { PATHS } from "../consts/paths";
|
import { PATHS } from "../consts/paths";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @export
|
||||||
|
* @param {string} dirname
|
||||||
|
*/
|
||||||
|
export function ensureDir(dirname: string): void {
|
||||||
|
if (!fs.existsSync(dirname)) {
|
||||||
|
fs.mkdirSync(dirname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets default value
|
* Gets default value
|
||||||
* @export
|
* @export
|
||||||
|
@ -34,6 +44,22 @@ export function getAbsolutePath(input: string): string {
|
||||||
return path.join(PATHS.VSIX_DIR, input);
|
return path.join(PATHS.VSIX_DIR, input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @export
|
||||||
|
* @returns {string[]}
|
||||||
|
*/
|
||||||
|
export function getAccentableIcons(): string[] {
|
||||||
|
return getDefaultValues().accentableIcons;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @export
|
||||||
|
* @returns {string[]}
|
||||||
|
*/
|
||||||
|
export function getVariantIcons(): string[] {
|
||||||
|
return getDefaultValues().variantsIcons;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a theme content by a given contribute ID
|
* Gets a theme content by a given contribute ID
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,7 +2,7 @@ import * as vscode from 'vscode';
|
||||||
|
|
||||||
import { IDefaults } from "../interfaces/idefaults";
|
import { IDefaults } from "../interfaces/idefaults";
|
||||||
import { IThemeCustomProperties } from "../interfaces/itheme-custom-properties";
|
import { IThemeCustomProperties } from "../interfaces/itheme-custom-properties";
|
||||||
import { getPackageJSON } from "./fs";
|
import {getPackageJSON} from './fs';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets saved accent
|
* Gets saved accent
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
export interface IDefaults {
|
export interface IDefaults {
|
||||||
accents: IAccents;
|
accents: IAccents;
|
||||||
|
accentableIcons: string[];
|
||||||
changelog: IChangelog;
|
changelog: IChangelog;
|
||||||
icons: IDefaultsThemeIcons;
|
icons: IDefaultsThemeIcons;
|
||||||
themeVariants: IDefaultsThemeVariant;
|
themeVariants: IDefaultsThemeVariant;
|
||||||
themeVariantsColours: IDefaultsThemeVariantColours;
|
themeVariantsColours: IDefaultsThemeVariantColours;
|
||||||
themeVariantsUITheme: IDefaultsThemeVariantUITheme;
|
themeVariantsUITheme: IDefaultsThemeVariantUITheme;
|
||||||
|
variantsIcons: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IAccents {
|
export interface IAccents {
|
||||||
|
@ -31,10 +33,10 @@ export interface IDefaultsThemeIcons {
|
||||||
_folder_dark_build: {
|
_folder_dark_build: {
|
||||||
iconPath: string;
|
iconPath: string;
|
||||||
}
|
}
|
||||||
"_file_folder-build": {
|
"_folder_light_build": {
|
||||||
iconPath: string;
|
iconPath: string;
|
||||||
}
|
}
|
||||||
_file_folder: {
|
_folder_light: {
|
||||||
iconPath: string;
|
iconPath: string;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ export interface IThemeIcons {
|
||||||
"iconDefinitions":
|
"iconDefinitions":
|
||||||
{
|
{
|
||||||
"_folder_dark": IThemeIconsIconPath;
|
"_folder_dark": IThemeIconsIconPath;
|
||||||
|
"_file_folder": IThemeIconsIconPath;
|
||||||
"_folder_dark_build": IThemeIconsIconPath;
|
"_folder_dark_build": IThemeIconsIconPath;
|
||||||
"_folder_light": IThemeIconsIconPath;
|
"_folder_light": IThemeIconsIconPath;
|
||||||
"_folder_light_build": IThemeIconsIconPath;
|
"_folder_light_build": IThemeIconsIconPath;
|
||||||
|
@ -51,7 +52,6 @@ export interface IThemeIcons {
|
||||||
"_file_folder-light": IThemeIconsIconPath;
|
"_file_folder-light": IThemeIconsIconPath;
|
||||||
"_file_folder-outline-build": IThemeIconsIconPath;
|
"_file_folder-outline-build": IThemeIconsIconPath;
|
||||||
"_file_folder-outline": IThemeIconsIconPath;
|
"_file_folder-outline": IThemeIconsIconPath;
|
||||||
"_file_folder": IThemeIconsIconPath;
|
|
||||||
"_file_font": IThemeIconsIconPath;
|
"_file_font": IThemeIconsIconPath;
|
||||||
"_file_fsharp": IThemeIconsIconPath;
|
"_file_fsharp": IThemeIconsIconPath;
|
||||||
"_file_git": IThemeIconsIconPath;
|
"_file_git": IThemeIconsIconPath;
|
||||||
|
|
2314
package-lock.json
generated
|
@ -70,7 +70,7 @@
|
||||||
"themes": [
|
"themes": [
|
||||||
{
|
{
|
||||||
"label": "Material Theme",
|
"label": "Material Theme",
|
||||||
"path": "./themes/Material-Theme-Default.json",
|
"path": "./themes/Material-Theme-Darker.json",
|
||||||
"uiTheme": "vs-dark"
|
"uiTheme": "vs-dark"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
|
@ -91,14 +91,14 @@
|
||||||
"xlsx": "_file_table",
|
"xlsx": "_file_table",
|
||||||
"xls": "_file_table",
|
"xls": "_file_table",
|
||||||
"csv": "_file_table",
|
"csv": "_file_table",
|
||||||
"vscodeignore": "_file_vs",
|
"vscodeignore": "_file_visualstudio",
|
||||||
"vsixmanifest": "_file_vs",
|
"vsixmanifest": "_file_visualstudio",
|
||||||
"suo": "_file_vs",
|
"suo": "_file_visualstudio",
|
||||||
"sln": "_file_vs",
|
"sln": "_file_visualstudio",
|
||||||
"pdb": "_file_database",
|
"pdb": "_file_database",
|
||||||
"cs": "_file_csharp",
|
"cs": "_file_csharp",
|
||||||
"csx": "_file_csharp",
|
"csx": "_file_csharp",
|
||||||
"csproj": "_file_vs",
|
"csproj": "_file_visualstudio",
|
||||||
"zip": "_file_zip",
|
"zip": "_file_zip",
|
||||||
"tar": "_file_zip",
|
"tar": "_file_zip",
|
||||||
"gz": "_file_zip",
|
"gz": "_file_zip",
|
||||||
|
@ -236,7 +236,7 @@
|
||||||
"project": "_file_xml",
|
"project": "_file_xml",
|
||||||
"patch": "_file_git",
|
"patch": "_file_git",
|
||||||
"dockerfile": "_file_docker",
|
"dockerfile": "_file_docker",
|
||||||
"vb": "_file_vs",
|
"vb": "_file_visualstudio",
|
||||||
"lua": "_file_lua",
|
"lua": "_file_lua",
|
||||||
"clj": "_file_clojure",
|
"clj": "_file_clojure",
|
||||||
"groovy": "_file_groovy",
|
"groovy": "_file_groovy",
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
".git": "_file_git",
|
".git": "_file_git",
|
||||||
".github": "_file_github",
|
".github": "_file_github",
|
||||||
".gulp": "_file_gulp",
|
".gulp": "_file_gulp",
|
||||||
|
".vscode": "_folder_vscode",
|
||||||
"bower_components": "_file_bower",
|
"bower_components": "_file_bower",
|
||||||
"build": "_folder_dark_build",
|
"build": "_folder_dark_build",
|
||||||
"dist": "_folder_dark_build"
|
"dist": "_folder_dark_build"
|
||||||
|
@ -13,6 +14,7 @@
|
||||||
".github": "_file_github",
|
".github": "_file_github",
|
||||||
".gulp": "_file_gulp",
|
".gulp": "_file_gulp",
|
||||||
"bower_components": "_file_bower",
|
"bower_components": "_file_bower",
|
||||||
|
".vscode": "_folder_vscode_open",
|
||||||
"build": "_folder_open_build",
|
"build": "_folder_open_build",
|
||||||
"dist": "_folder_open_build"
|
"dist": "_folder_open_build"
|
||||||
}
|
}
|
|
@ -1,28 +1,7 @@
|
||||||
"iconDefinitions": {
|
"iconDefinitions": {
|
||||||
"_folder_dark": {
|
|
||||||
"iconPath": "../icons/folder.svg"
|
|
||||||
},
|
|
||||||
"_folder_dark_build": {
|
|
||||||
"iconPath": "../icons/folder-build.svg"
|
|
||||||
},
|
|
||||||
"_folder_light": {
|
|
||||||
"iconPath": "../icons/folder-light.svg"
|
|
||||||
},
|
|
||||||
"_folder_light_build": {
|
|
||||||
"iconPath": "../icons/folder-light-build.svg"
|
|
||||||
},
|
|
||||||
"_folder_open": {
|
|
||||||
"iconPath": "../icons/folder-outline.svg"
|
|
||||||
},
|
|
||||||
"_folder_open_build": {
|
|
||||||
"iconPath": "../icons/folder-outline-build.svg"
|
|
||||||
},
|
|
||||||
"_file_dark": {
|
|
||||||
"iconPath": "../icons/file.svg"
|
|
||||||
},
|
|
||||||
{{#icons}}
|
{{#icons}}
|
||||||
"_file_{{name}}": {
|
"{{name}}": {
|
||||||
"iconPath": "../icons/{{name}}.svg"
|
"iconPath": "../icons/{{filename}}.svg"
|
||||||
}{{^last}},{{/last}}
|
}{{^last}},{{/last}}
|
||||||
{{/icons}}
|
{{/icons}}
|
||||||
},
|
},
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
".git": "_file_git",
|
".git": "_file_git",
|
||||||
".github": "_file_github",
|
".github": "_file_github",
|
||||||
".gulp": "_file_gulp",
|
".gulp": "_file_gulp",
|
||||||
|
".vscode": "_folder_vscode",
|
||||||
"bower_components": "_file_bower",
|
"bower_components": "_file_bower",
|
||||||
"build": "_folder_light_build",
|
"build": "_folder_light_build",
|
||||||
"dist": "_folder_light_build"
|
"dist": "_folder_light_build"
|
||||||
|
@ -15,8 +16,9 @@
|
||||||
".git": "_file_git",
|
".git": "_file_git",
|
||||||
".github": "_file_github",
|
".github": "_file_github",
|
||||||
".gulp": "_file_gulp",
|
".gulp": "_file_gulp",
|
||||||
|
".vscode": "_folder_vscode_open",
|
||||||
"bower_components": "_file_bower",
|
"bower_components": "_file_bower",
|
||||||
"build": "_folder_light_build",
|
"build": "_folder_open_build",
|
||||||
"dist": "_folder_light_build"
|
"dist": "_folder_open_build"
|
||||||
}
|
}
|
||||||
},
|
},
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 565 B After Width: | Height: | Size: 565 B |
Before Width: | Height: | Size: 835 B After Width: | Height: | Size: 835 B |
Before Width: | Height: | Size: 317 B After Width: | Height: | Size: 317 B |
Before Width: | Height: | Size: 796 B After Width: | Height: | Size: 796 B |
Before Width: | Height: | Size: 350 B After Width: | Height: | Size: 350 B |
Before Width: | Height: | Size: 883 B After Width: | Height: | Size: 883 B |
|
@ -1 +1 @@
|
||||||
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><defs><style>.st0{fill:#4a616c;}.st1{fill:#ffe0b2;}</style></defs><title>folder_vscode</title><path class="st0" d="M9.8,3,12,5.2h8.8A2.22,2.22,0,0,1,23,7.4V18.6a2.22,2.22,0,0,1-2.2,2.2H3.2a1.94,1.94,0,0,1-2.2-2V5.2A2.22,2.22,0,0,1,3.2,3Z"/><path class="st1" d="M20.87,9.38l-6.42,5.9-3.59-2.7-1.48.86,3.54,3.25L9.37,19.94l1.48.87,3.59-2.7L20.87,24,24,22.48V10.9Zm0,3.88v6.86l-4.55-3.43Z"/></svg>
|
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><defs><style>.st0{fill:#4a616c;enable-background:new;}.st1{fill:#ffcb6b;}</style></defs><path class="st0" d="M9.8,3,12,5.2h8.8A2.22,2.22,0,0,1,23,7.4V18.6a2.22,2.22,0,0,1-2.2,2.2H3.2a2,2,0,0,1-2.2-2V5.2A2.22,2.22,0,0,1,3.2,3Z"/><path class="st1" d="M21.08,10.36l-6,5.51-3.35-2.53-1.38.81,3.3,3-3.3,3,1.38.81,3.35-2.52,6,5.5L24,22.58V11.78Zm0,3.62v6.4l-4.25-3.2Z"/></svg>
|
Before Width: | Height: | Size: 487 B After Width: | Height: | Size: 463 B |
|
@ -1 +1 @@
|
||||||
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><defs><style>.st0{fill:#80cbc4;}.st1{fill:#ffe0b2;}</style></defs><title>folder_vscode_open</title><path class="st0" d="M20.8,5.25H12L9.8,3H3.2A2.23,2.23,0,0,0,1,5.25v13.5A2.23,2.23,0,0,0,3.2,21H20.8A2.23,2.23,0,0,0,23,18.75V7.5A2.23,2.23,0,0,0,20.8,5.25Zm0,13.5H3.2V7.5H20.8Z"/><path class="st1" d="M20.87,9.38l-6.42,5.9-3.59-2.7-1.48.86,3.54,3.25L9.37,19.94l1.48.87,3.59-2.7L20.87,24,24,22.48V10.9Zm0,3.88v6.86l-4.55-3.43Z"/></svg>
|
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><defs><style>.st0{fill:#80cbc4;enable-background:new;}.st1{fill:#ffcb6b;}</style></defs><path class="st0" d="M20.8,5.25H12L9.8,3H3.2A2.23,2.23,0,0,0,1,5.25v13.5A2.23,2.23,0,0,0,3.2,21H20.8A2.23,2.23,0,0,0,23,18.75V7.5A2.23,2.23,0,0,0,20.8,5.25Zm0,13.5H3.2V7.5H20.8Z"/><path class="st1" d="M21.08,10.36l-6,5.51-3.35-2.53-1.38.81,3.3,3-3.3,3,1.38.81,3.35-2.52,6,5.5L24,22.58V11.78Zm0,3.62v6.4l-4.25-3.2Z"/></svg>
|
Before Width: | Height: | Size: 526 B After Width: | Height: | Size: 503 B |