Add tslint

This commit is contained in:
Daniel Imms
2018-04-26 09:52:50 -07:00
parent 250c62554a
commit 2c50c2ff0b
7 changed files with 125 additions and 17 deletions

View File

@@ -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;

View File

@@ -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);
}

View File

@@ -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 };
}

View File

@@ -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[] = [

View File

@@ -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);
@@ -146,7 +146,7 @@ export class VscodeThemeGenerator implements IThemeGenerator {
theme.colors['tab.activeBorder'] = colorSet.base.color1;
theme.colors['tab.inactiveBackground'] = background4;
// tab.inactiveForeground: Inactive tab foreground color in an active group. Tabs are the containers for editors in the editor area. Multiple tabs can be opened in one editor group. There can be multiple editor groups.
// Editor Colors
// editor.background: Editor background color.
theme.colors['editor.background'] = background2;