mirror of
https://github.com/Tyriar/vscode-theme-generator.git
synced 2025-12-06 17:15:43 -08:00
Add tslint
This commit is contained in:
@@ -8,7 +8,8 @@
|
||||
"build": "tsc",
|
||||
"prestart": "tsc demo/generate.ts",
|
||||
"start": "node demo/generate.js",
|
||||
"prepublish": "npm run build"
|
||||
"prepublish": "npm run build",
|
||||
"lint": "tslint src/*.ts"
|
||||
},
|
||||
"author": "Tyriar",
|
||||
"license": "MIT",
|
||||
@@ -22,6 +23,8 @@
|
||||
"typings": "dist/index",
|
||||
"devDependencies": {
|
||||
"@types/node": "^6.0.41",
|
||||
"tslint": "^5.9.1",
|
||||
"tslint-consistent-codestyle": "^1.13.0",
|
||||
"typescript": "^2.8.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { IColorSet, IBaseColorSet } from "./interfaces";
|
||||
import { IColorSet, IBaseColorSet } from './interfaces';
|
||||
|
||||
export function lighten(color: string, amount: number): string {
|
||||
const MAX = 255;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import { IColorSet } from './interfaces'
|
||||
import { VscodeThemeGenerator } from './vscodeThemeGenerator'
|
||||
import { IColorSet } from './interfaces';
|
||||
import { VscodeThemeGenerator } from './vscodeThemeGenerator';
|
||||
|
||||
export function generateTheme(themeName: string, colorSet: IColorSet, outputFile: string) {
|
||||
export function generateTheme(themeName: string, colorSet: IColorSet, outputFile: string): void {
|
||||
const themeJson = new VscodeThemeGenerator().generateTheme(themeName, colorSet);
|
||||
fs.writeFileSync(outputFile, themeJson);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ export interface IBaseColorSet {
|
||||
}
|
||||
|
||||
export interface IColorSet {
|
||||
base: IBaseColorSet,
|
||||
base: IBaseColorSet;
|
||||
syntax?: {
|
||||
boolean?: string;
|
||||
function?: string;
|
||||
@@ -33,7 +33,7 @@ export interface IColorSet {
|
||||
cssId?: string;
|
||||
cssTag?: string;
|
||||
markdownQuote?: string;
|
||||
}
|
||||
};
|
||||
ui?: {
|
||||
/** The color of the editor cursor/caret */
|
||||
cursor?: string;
|
||||
@@ -56,7 +56,7 @@ export interface IColorSet {
|
||||
wordHighlight?: string;
|
||||
wordHighlightStrong?: string;
|
||||
activeLinkForeground?: string;
|
||||
},
|
||||
};
|
||||
terminal?: {
|
||||
black?: string;
|
||||
red?: string;
|
||||
@@ -74,6 +74,6 @@ export interface IColorSet {
|
||||
brightMagenta?: string;
|
||||
brightCyan?: string;
|
||||
brightWhite?: string;
|
||||
},
|
||||
overrides?: { [key: string]: string }
|
||||
};
|
||||
overrides?: { [key: string]: string };
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { IColorSet, IThemeGenerator, IBaseColorSet } from './interfaces'
|
||||
import { IColorSet, IThemeGenerator, IBaseColorSet } from './interfaces';
|
||||
import { darken, lighten } from './color';
|
||||
|
||||
export interface IVscodeJsonThemeSetting {
|
||||
@@ -18,7 +18,7 @@ export interface IRuleGenerator {
|
||||
generate: ColorGenerator;
|
||||
}
|
||||
|
||||
enum FontStyle {
|
||||
const enum FontStyle {
|
||||
NONE = 0,
|
||||
ITALIC = 1 << 0,
|
||||
BOLD = 1 << 1,
|
||||
@@ -32,7 +32,7 @@ function getGlobalSettingGenerator(name: string): ColorGenerator {
|
||||
}
|
||||
const result: any = {};
|
||||
result[name] = color;
|
||||
return result
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ function getSimpleColorGenerator(name: string, scope: string, fontStyle: number
|
||||
colorRule.settings.fontStyle = fontStyles.join(' ');
|
||||
}
|
||||
return colorRule;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export const globalRules: IRuleGenerator[] = [
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { IColorSet, IThemeGenerator, IBaseColorSet } from './interfaces'
|
||||
import { IColorSet, IThemeGenerator, IBaseColorSet } from './interfaces';
|
||||
import { darken, lighten, generateFallbackColorSet, addAlpha } from './color';
|
||||
import { tokenRules, globalRules, IVscodeJsonThemeSetting } from './rules';
|
||||
|
||||
@@ -50,7 +50,7 @@ export class VscodeThemeGenerator implements IThemeGenerator {
|
||||
return JSON.stringify(theme, null, 2);
|
||||
}
|
||||
|
||||
private _applyWorkbenchColors(theme: IVscodeJsonTheme, colorSet: IColorSet) {
|
||||
private _applyWorkbenchColors(theme: IVscodeJsonTheme, colorSet: IColorSet): void {
|
||||
const background1 = darken(colorSet.base.background, 0.2);
|
||||
const background2 = colorSet.base.background;
|
||||
const background3 = lighten(colorSet.base.background, 0.2);
|
||||
|
||||
105
tslint.json
Normal file
105
tslint.json
Normal file
@@ -0,0 +1,105 @@
|
||||
{
|
||||
"rulesDirectory": [
|
||||
"tslint-consistent-codestyle"
|
||||
],
|
||||
"rules": {
|
||||
"array-type": [
|
||||
true,
|
||||
"array"
|
||||
],
|
||||
"class-name": true,
|
||||
"comment-format": [
|
||||
true,
|
||||
"check-space"
|
||||
],
|
||||
"curly": [
|
||||
true,
|
||||
"ignore-same-line"
|
||||
],
|
||||
"indent": [
|
||||
true,
|
||||
"spaces"
|
||||
],
|
||||
"interface-name": [
|
||||
true,
|
||||
"always-prefix"
|
||||
],
|
||||
"interface-over-type-literal": true,
|
||||
"typedef": [
|
||||
true,
|
||||
"call-signature",
|
||||
"parameter"
|
||||
],
|
||||
"eofline": true,
|
||||
"no-duplicate-imports": true,
|
||||
"no-eval": true,
|
||||
"no-internal-module": true,
|
||||
"no-trailing-whitespace": true,
|
||||
"one-variable-per-declaration": true,
|
||||
"no-unsafe-finally": true,
|
||||
"no-var-keyword": true,
|
||||
"quotemark": [
|
||||
true,
|
||||
"single"
|
||||
],
|
||||
"semicolon": [
|
||||
true,
|
||||
"always"
|
||||
],
|
||||
"trailing-comma": [
|
||||
true,
|
||||
{
|
||||
"multiline": {
|
||||
"objects": "never",
|
||||
"arrays": "never",
|
||||
"functions": "never",
|
||||
"typeLiterals": "ignore"
|
||||
},
|
||||
"esSpecCompliant": true
|
||||
}
|
||||
],
|
||||
"triple-equals": [
|
||||
true,
|
||||
"allow-null-check"
|
||||
],
|
||||
"typedef-whitespace": [
|
||||
true,
|
||||
{
|
||||
"call-signature": "nospace",
|
||||
"index-signature": "nospace",
|
||||
"parameter": "nospace",
|
||||
"property-declaration": "nospace",
|
||||
"variable-declaration": "nospace"
|
||||
}
|
||||
],
|
||||
"variable-name": [
|
||||
true,
|
||||
"ban-keywords",
|
||||
"check-format",
|
||||
"allow-leading-underscore"
|
||||
],
|
||||
"whitespace": [
|
||||
true,
|
||||
"check-branch",
|
||||
"check-decl",
|
||||
"check-module",
|
||||
"check-operator",
|
||||
"check-rest-spread",
|
||||
"check-separator",
|
||||
"check-type",
|
||||
"check-type-operator",
|
||||
"check-preblock"
|
||||
],
|
||||
|
||||
"naming-convention": [
|
||||
true,
|
||||
{"type": "property", "modifiers": ["public", "static", "const"], "format": "UPPER_CASE"}
|
||||
],
|
||||
"no-else-after-return": {
|
||||
"options": "allow-else-if"
|
||||
},
|
||||
"prefer-const-enum": [
|
||||
true
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user