Initial commit

This commit is contained in:
Daniel Imms
2016-10-01 13:07:15 -07:00
commit c2a3cb7ee5
10 changed files with 164 additions and 0 deletions

9
.editorconfig Normal file
View 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
View File

@@ -0,0 +1,5 @@
dist/
node_modules/
typings/
out/theme.json

3
README.md Normal file
View File

@@ -0,0 +1,3 @@
```bash
npm run build
```

13
out/.vscode/launch.json vendored Normal file
View 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
View 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
View 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
View 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
View File

@@ -0,0 +1 @@
{"name":"Generated theme","settings":[{"name":"Function declarations","scope":"entity.name.function","settings":{"foreground":"#F00"}}]}

12
tsconfig.json Normal file
View 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
View File

@@ -0,0 +1,6 @@
{
"name": "theme-generator",
"globalDependencies": {
"node": "registry:env/node#6.0.0+20160918225031"
}
}