mirror of
https://github.com/Tyriar/vscode-theme-generator.git
synced 2025-12-07 09:36:11 -08:00
Progress
This commit is contained in:
93
src/index.ts
93
src/index.ts
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user