More progress, update to use 1.9 scopes
This commit is contained in:
@@ -8,6 +8,7 @@ function func(param) {
|
||||
var templateLiterals = `a ${text} b ${1 + 2} c`;
|
||||
return {
|
||||
"text": text,
|
||||
"boolean": false
|
||||
"boolean": false,
|
||||
"number": 231
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,13 +1,27 @@
|
||||
import { a } from 'some-file';
|
||||
|
||||
/**
|
||||
* Comment
|
||||
*/
|
||||
class Example {
|
||||
private static readonly _a: string = 'foo';
|
||||
|
||||
private _c: boolean = true;
|
||||
|
||||
private get a() {
|
||||
return this._a;
|
||||
return Example._a;
|
||||
}
|
||||
|
||||
public b(arg1: number, arg2: boolean): string {
|
||||
return `${arg1} ${arg2}`;
|
||||
}
|
||||
}
|
||||
|
||||
function someFunction(arg1, arg2) {
|
||||
}
|
||||
|
||||
var a = {
|
||||
a: 1,
|
||||
b: 2,
|
||||
"c": true
|
||||
}
|
||||
|
||||
37
src/index.ts
37
src/index.ts
@@ -41,7 +41,42 @@ const glacierColorSet: IColorSet = {
|
||||
cursor: '#ffe792'
|
||||
}
|
||||
};
|
||||
const themeJson = new VscodeThemeGenerator().generateTheme('Generated theme 2', glacierColorSet);
|
||||
|
||||
const colorset2colors = {
|
||||
red: '#DA6771',
|
||||
redLight: '#e5949b',
|
||||
green: '#4EB071',
|
||||
yellow: '#FFEA75',
|
||||
blue: '#399EF4',
|
||||
blueLight: '#9fcff9',
|
||||
pink: '#B168DF',
|
||||
teal: '#21C5C7',
|
||||
grey: '#4A5160'
|
||||
}
|
||||
|
||||
const colorSet2: IColorSet = {
|
||||
syntax: {
|
||||
identifier: colorset2colors.blueLight,
|
||||
string: colorset2colors.red,
|
||||
number: colorset2colors.redLight,
|
||||
keyword: colorset2colors.blue,
|
||||
boolean: colorset2colors.blue,
|
||||
function: colorset2colors.teal,
|
||||
functionCall: colorset2colors.yellow,
|
||||
storage: colorset2colors.blue,
|
||||
comment: colorset2colors.grey,
|
||||
class: colorset2colors.teal,
|
||||
classMember: colorset2colors.teal,
|
||||
type: colorset2colors.green,
|
||||
this: colorset2colors.blue
|
||||
},
|
||||
ui: {
|
||||
background: '#151B24',
|
||||
foreground: '#efefef',
|
||||
cursor: '#ffffff'
|
||||
}
|
||||
};
|
||||
const themeJson = new VscodeThemeGenerator().generateTheme('Generated theme 2', colorSet2);
|
||||
const outputFile = path.join(__dirname, '..', 'out', 'theme.json')
|
||||
|
||||
fs.writeFileSync(outputFile, themeJson);
|
||||
|
||||
@@ -5,6 +5,7 @@ export interface IThemeGenerator {
|
||||
export interface IColorSet {
|
||||
syntax?: {
|
||||
boolean?: string;
|
||||
function?: string;
|
||||
functionCall?: string;
|
||||
identifier?: string;
|
||||
keyword?: string;
|
||||
@@ -13,8 +14,10 @@ export interface IColorSet {
|
||||
string?: string;
|
||||
comment?: string;
|
||||
class?: string;
|
||||
classMember?: string;
|
||||
type?: string;
|
||||
modifier?: string;
|
||||
this?: string;
|
||||
}
|
||||
ui?: {
|
||||
/** The default background color */
|
||||
|
||||
@@ -88,34 +88,48 @@ const vscodeJsonThemeRules: IRuleGenerator[] = [
|
||||
{ source: set => set.syntax.string,
|
||||
generate: getSimpleColorGenerator('String', 'string') },
|
||||
{ source: set => set.syntax.boolean,
|
||||
generate: getSimpleColorGenerator('Boolean', 'boolean') },
|
||||
generate: getSimpleColorGenerator('Boolean', 'constant.language.boolean') },
|
||||
{ source: set => set.syntax.number,
|
||||
generate: getSimpleColorGenerator('Number', 'constant.numeric') },
|
||||
{ source: set => set.syntax.identifier,
|
||||
generate: getSimpleColorGenerator('Identifier', 'variable') },
|
||||
generate: getSimpleColorGenerator('Identifier', 'variable, support.variable, support.class, support.constant') },
|
||||
{ source: set => set.syntax.keyword,
|
||||
generate: getSimpleColorGenerator('Keyword', 'keyword, modifier, language.this') },
|
||||
// support.function: eg. join in path.join in TypeScript
|
||||
{ source: set => set.syntax.functionCall,
|
||||
generate: getSimpleColorGenerator('Function call', 'entity.name.function, support.function') },
|
||||
// storage.type: var (ts)
|
||||
// storage.modifier: private (ts)
|
||||
{ source: set => set.syntax.storage,
|
||||
generate: getSimpleColorGenerator('Storage', 'storage.type') },
|
||||
generate: getSimpleColorGenerator('Storage', 'storage.type, storage.modifier') },
|
||||
// module.support: imported modules in TypeScript
|
||||
{ source: set => set.syntax.identifier,
|
||||
generate: getSimpleColorGenerator('Modules', 'support.module, support.node', FontStyle.ITALIC) },
|
||||
// support.type: `boolean` (ts)
|
||||
{ source: set => set.syntax.type,
|
||||
generate: getSimpleColorGenerator('Type', 'type, declaration.entity.name.class') },
|
||||
generate: getSimpleColorGenerator('Type', 'support.type', FontStyle.BOLD) },
|
||||
// entity.name.type: `: SomeType` (ts)
|
||||
{ source: set => set.syntax.type,
|
||||
generate: getSimpleColorGenerator('Type', 'entity.name.type, entity.other.inherited-class') },
|
||||
{ source: set => set.syntax.comment,
|
||||
generate: getSimpleColorGenerator('Comment', 'comment', FontStyle.ITALIC) },
|
||||
{ source: set => set.syntax.class,
|
||||
generate: getSimpleColorGenerator('Class', 'entity.name.class', FontStyle.UNDERLINE) },
|
||||
generate: getSimpleColorGenerator('Class', 'entity.name.type.class', FontStyle.UNDERLINE) },
|
||||
{ source: set => set.syntax.classMember,
|
||||
generate: getSimpleColorGenerator('Class variable', 'variable.object.property') },
|
||||
{ source: set => set.syntax.classMember,
|
||||
generate: getSimpleColorGenerator('Class method', 'meta.definition.method entity.name.function') },
|
||||
{ source: set => set.syntax.function,
|
||||
generate: getSimpleColorGenerator('Function definition', 'meta.function entity.name.function') },
|
||||
{ source: set => set.syntax.keyword,
|
||||
generate: getSimpleColorGenerator('Template expression', 'template.expression.begin, template.expression.end') },
|
||||
{ source: set => set.syntax.storage,
|
||||
generate: getSimpleColorGenerator('JSON key', 'object-literal.member.key') },
|
||||
{ source: set => set.syntax.identifier,
|
||||
generate: getSimpleColorGenerator('JSON key', 'meta.object-literal.key') },
|
||||
// modifier: This includes things like access modifiers, static, readonly, etc.
|
||||
{ source: set => set.syntax.modifier,
|
||||
generate: getSimpleColorGenerator('Modifier', 'modifier') }
|
||||
generate: getSimpleColorGenerator('Modifier', 'modifier') },
|
||||
{ source: set => set.syntax.this,
|
||||
generate: getSimpleColorGenerator('This variable', 'variable.language.this') }
|
||||
];
|
||||
|
||||
export class VscodeThemeGenerator implements IThemeGenerator {
|
||||
|
||||
Reference in New Issue
Block a user