This commit is contained in:
Daniel Imms
2016-10-01 14:37:15 -07:00
parent c2a3cb7ee5
commit bf4f63a0e6
4 changed files with 177 additions and 73 deletions

View File

@@ -2,77 +2,26 @@
import * as fs from 'fs';
import * as path from 'path';
console.log('test');
interface IColorSet {
ansiGroups?: {
ansiNormal?: IAnsiColorSet;
ansiBright?: IAnsiColorSet;
}
syntaxGroups?: {
constant?: string;
identifier?: string;
statement?: string;
type?: string;
global?: string;
emphasis?: string;
special?: string;
trivial?: string;
}
uiGroups?: {
userActionNeeded?: string;
userCurrentState?: string;
backgroundState?: string;
background?: string;
foreground?: string;
}
}
interface IAnsiColorSet {
black?: string;
red?: string;
green?: string;
yellow?: string;
blue?: string;
magenta?: string;
cyan?: string;
white?: string;
}
interface IThemeGenerator {
generateTheme(colorSet: IColorSet): string;
}
interface IVscodeJsonTheme {
name?: string;
include?: string;
settings?: any[];
}
class VscodeThemeGenerator implements IThemeGenerator {
public generateTheme(colorSet: IColorSet): string {
let theme: IVscodeJsonTheme = {};
theme.name = 'Generated theme';
theme.settings = [];
if (colorSet.syntaxGroups.identifier) {
theme.settings.push({
'name': 'Function declarations',
'scope': 'entity.name.function',
'settings': {
'foreground': colorSet.syntaxGroups.identifier
}
});
}
return JSON.stringify(theme);
}
}
import { IColorSet } from './themeGenerator'
import { VscodeThemeGenerator } from './vscodeThemeGenerator'
const colorSet: IColorSet = {
syntaxGroups: {
identifier: '#F00'
}
};
const themeJson = new VscodeThemeGenerator().generateTheme(colorSet);
const outputFile = path.join(__dirname, '..', 'out', 'theme.json')
fs.writeFileSync(outputFile, themeJson);
syntax: {
identifier: '#ffffff',
string: '#87d75f',
number: '#ffcc66',
keyword: '#ff8f7e',
functionCall: '#cae682',
storage: '#88b8f6',
comment: '#989898',
class: '#cae682',
type: '#88b8f6'
},
ui: {
background: '#151515'
}
};
const themeJson = new VscodeThemeGenerator().generateTheme('Generated theme 2', colorSet);
const outputFile = path.join(__dirname, '..', 'out', 'theme.json')
fs.writeFileSync(outputFile, themeJson);