Initial commit
This commit is contained in:
9
.editorconfig
Normal file
9
.editorconfig
Normal file
@@ -0,0 +1,9 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
dist/
|
||||
node_modules/
|
||||
typings/
|
||||
|
||||
out/theme.json
|
||||
13
out/.vscode/launch.json
vendored
Normal file
13
out/.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
// A launch configuration that launches the extension inside a new window
|
||||
{
|
||||
"version": "0.1.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Launch Extension",
|
||||
"type": "extensionHost",
|
||||
"request": "launch",
|
||||
"runtimeExecutable": "${execPath}",
|
||||
"args": ["--extensionDevelopmentPath=${workspaceRoot}" ]
|
||||
}
|
||||
]
|
||||
}
|
||||
18
out/package.json
Normal file
18
out/package.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "generated-theme",
|
||||
"displayName": "Generated THeme",
|
||||
"description": "...",
|
||||
"categories": [ "Themes" ],
|
||||
"version": "0.0.1",
|
||||
"publisher": "vscode",
|
||||
"engines": { "vscode": "*" },
|
||||
"contributes": {
|
||||
"themes": [
|
||||
{
|
||||
"label": "Generated theme",
|
||||
"uiTheme": "vs-dark",
|
||||
"path": "./theme.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
19
package.json
Normal file
19
package.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "theme-generator",
|
||||
"version": "0.0.1",
|
||||
"description": "Generates editor/terminal themes using a set of colors",
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
"build": "typings install && tsc"
|
||||
},
|
||||
"author": "Tyriar",
|
||||
"license": "MIT",
|
||||
"typescript": {
|
||||
"definition": "index.d.ts"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^6.0.41",
|
||||
"typescript": "^2.0.3",
|
||||
"typings": "^1.4.0"
|
||||
}
|
||||
}
|
||||
78
src/index.ts
Normal file
78
src/index.ts
Normal file
@@ -0,0 +1,78 @@
|
||||
///<reference path="../typings/globals/node/index.d.ts"/>
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
const colorSet: IColorSet = {
|
||||
syntaxGroups: {
|
||||
identifier: '#F00'
|
||||
}
|
||||
};
|
||||
const themeJson = new VscodeThemeGenerator().generateTheme(colorSet);
|
||||
const outputFile = path.join(__dirname, '..', 'out', 'theme.json')
|
||||
fs.writeFileSync(outputFile, themeJson);
|
||||
1
theme.json
Normal file
1
theme.json
Normal file
@@ -0,0 +1 @@
|
||||
{"name":"Generated theme","settings":[{"name":"Function declarations","scope":"entity.name.function","settings":{"foreground":"#F00"}}]}
|
||||
12
tsconfig.json
Normal file
12
tsconfig.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"module": "commonjs",
|
||||
"target": "es5",
|
||||
"noImplicitAny": true,
|
||||
"outDir": "dist"
|
||||
},
|
||||
"files": [
|
||||
"src/index.ts"
|
||||
]
|
||||
}
|
||||
6
typings.json
Normal file
6
typings.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "theme-generator",
|
||||
"globalDependencies": {
|
||||
"node": "registry:env/node#6.0.0+20160918225031"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user