Start light theme support, improve launch.json

Part of #22
This commit is contained in:
Daniel Imms
2018-04-26 12:37:09 -07:00
parent 6db07527fa
commit 0901714136
7 changed files with 66 additions and 49 deletions

View File

@@ -38,8 +38,9 @@ export function addAlpha(color: string, alpha: number): string {
return color + alphaHex;
}
export function generateFallbackColorSet(s: IBaseColorSet): IColorSet {
export function generateFallbackColorSet(s: IBaseColorSet, type: 'light' | 'dark'): IColorSet {
return {
type,
base: {
background: null,
foreground: null,
@@ -52,12 +53,12 @@ export function generateFallbackColorSet(s: IBaseColorSet): IColorSet {
boolean: s.color1,
function: s.color3,
functionCall: s.color4,
identifier: lighten(s.color1, 0.5),
identifier: (type === 'light' ? darken : lighten)(s.color1, 0.5),
keyword: s.color1,
number: s.color4,
storage: s.color1,
string: s.color2,
comment: lighten(s.background, 2.0),
comment: (type === 'light' ? darken : lighten)(s.background, 2.0),
class: s.color3,
classMember: s.color3,
type: s.color3,
@@ -69,8 +70,8 @@ export function generateFallbackColorSet(s: IBaseColorSet): IColorSet {
},
ui: {
cursor: null,
invisibles: lighten(s.background, 0.2),
guide: lighten(s.background, 0.2),
invisibles: (type === 'light' ? darken : lighten)(s.background, 0.2),
guide: (type === 'light' ? darken : lighten)(s.background, 0.2),
lineHighlight: null,
findMatchHighlight: null,
currentFindMatchHighlight: null,

View File

@@ -14,6 +14,7 @@ export interface IBaseColorSet {
}
export interface IColorSet {
type: 'light' | 'dark';
base: IBaseColorSet;
syntax?: {
boolean?: string;

View File

@@ -16,7 +16,7 @@ export class VscodeThemeGenerator implements IThemeGenerator {
if (!colorSet.terminal) colorSet.terminal = {};
if (!colorSet.ui) colorSet.ui = {};
const fallbackColorSet = generateFallbackColorSet(colorSet.base);
const fallbackColorSet = generateFallbackColorSet(colorSet.base, colorSet.type);
const theme: IVscodeJsonTheme = {
name: name,
@@ -51,11 +51,11 @@ export class VscodeThemeGenerator implements IThemeGenerator {
}
private _applyWorkbenchColors(theme: IVscodeJsonTheme, colorSet: IColorSet): void {
const background1 = darken(colorSet.base.background, 0.2);
const background1 = (colorSet.type === 'light' ? lighten : darken)(colorSet.base.background, 0.2);
const background2 = colorSet.base.background;
const background3 = lighten(colorSet.base.background, 0.2);
const background4 = lighten(colorSet.base.background, 0.4);
const background5 = lighten(colorSet.base.background, 0.6);
const background3 = (colorSet.type === 'light' ? darken : lighten)(colorSet.base.background, 0.2);
const background4 = (colorSet.type === 'light' ? darken : lighten)(colorSet.base.background, 0.4);
const background5 = (colorSet.type === 'light' ? darken : lighten)(colorSet.base.background, 0.6);
// Contrast colors
// contrastActiveBorder: An extra border around active elements to separate them from others for greater contrast.