From 888e8fee769e65f5bb0e8288582d6251f0d89ba6 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Thu, 4 May 2017 09:39:54 -0700 Subject: [PATCH] Fix terminal colors --- src/rules.ts | 19 ------------------- src/vscodeThemeGenerator.ts | 26 +++++++++++++++++--------- 2 files changed, 17 insertions(+), 28 deletions(-) diff --git a/src/rules.ts b/src/rules.ts index d107516..dd94ae8 100644 --- a/src/rules.ts +++ b/src/rules.ts @@ -67,25 +67,6 @@ export const globalRules: IRuleGenerator[] = [ { color: s => s.base.foreground, generate: getGlobalSettingGenerator('foreground') } ]; -export const terminalRules: IRuleGenerator[] = [ - { color: s => s.terminal.black, generate: getGlobalSettingGenerator('terminalAnsiBlack') }, - { color: s => s.terminal.red, generate: getGlobalSettingGenerator('terminalAnsiRed') }, - { color: s => s.terminal.green, generate: getGlobalSettingGenerator('terminalAnsiGreen') }, - { color: s => s.terminal.yellow, generate: getGlobalSettingGenerator('terminalAnsiYellow') }, - { color: s => s.terminal.blue, generate: getGlobalSettingGenerator('terminalAnsiBlue') }, - { color: s => s.terminal.magenta, generate: getGlobalSettingGenerator('terminalAnsiMagenta') }, - { color: s => s.terminal.cyan, generate: getGlobalSettingGenerator('terminalAnsiCyan') }, - { color: s => s.terminal.white, generate: getGlobalSettingGenerator('terminalAnsiWhite') }, - { color: s => s.terminal.brightBlack, generate: getGlobalSettingGenerator('terminalAnsiBrightBlack') }, - { color: s => s.terminal.brightRed, generate: getGlobalSettingGenerator('terminalAnsiBrightRed') }, - { color: s => s.terminal.brightGreen, generate: getGlobalSettingGenerator('terminalAnsiBrightGreen') }, - { color: s => s.terminal.brightYellow, generate: getGlobalSettingGenerator('terminalAnsiBrightYellow') }, - { color: s => s.terminal.brightBlue, generate: getGlobalSettingGenerator('terminalAnsiBrightBlue') }, - { color: s => s.terminal.brightMagenta, generate: getGlobalSettingGenerator('terminalAnsiBrightMagenta') }, - { color: s => s.terminal.brightCyan, generate: getGlobalSettingGenerator('terminalAnsiBrightCyan') }, - { color: s => s.terminal.brightWhite, generate: getGlobalSettingGenerator('terminalAnsiBrightWhite') } -]; - export const colorRules: IRuleGenerator[] = [ { color: s => s.base.background, generate: getGlobalSettingGenerator('editorBackground') }, { color: s => s.base.foreground, generate: getGlobalSettingGenerator('editorForeground') }, diff --git a/src/vscodeThemeGenerator.ts b/src/vscodeThemeGenerator.ts index 8bd67bf..b95b6c0 100644 --- a/src/vscodeThemeGenerator.ts +++ b/src/vscodeThemeGenerator.ts @@ -1,6 +1,6 @@ import { IColorSet, IThemeGenerator, IBaseColorSet } from './interfaces' import { darken, lighten, generateFallbackColorSet, addAlpha } from './color'; -import { tokenRules, terminalRules, colorRules, globalRules, IVscodeJsonThemeSetting } from './rules'; +import { tokenRules, colorRules, globalRules, IVscodeJsonThemeSetting } from './rules'; export interface IVscodeJsonTheme { name?: string; @@ -36,14 +36,6 @@ export class VscodeThemeGenerator implements IThemeGenerator { } }); - colorRules.concat(terminalRules).forEach(generator => { - const color = generator.color(colorSet) || generator.color(fallbackColorSet); - if (color) { - const generated = generator.generate(color); - theme.colors[Object.keys(generated)[0]] = color; - } - }); - globalRules.forEach(generator => { const color = generator.color(colorSet) || generator.color(fallbackColorSet); if (color) { @@ -265,21 +257,37 @@ export class VscodeThemeGenerator implements IThemeGenerator { // Terminal Colors // terminal.ansiBlack: 'Black' ansi color in the terminal. + if (colorSet.terminal.black) theme.colors['terminal.ansiBlack'] = colorSet.terminal.black; // terminal.ansiBlue: 'Blue' ansi color in the terminal. + if (colorSet.terminal.blue) theme.colors['terminal.ansiBlue'] = colorSet.terminal.blue; // terminal.ansiBrightBlack: 'BrightBlack' ansi color in the terminal. + if (colorSet.terminal.brightBlack) theme.colors['terminal.ansiBrightBlack'] = colorSet.terminal.brightBlack; // terminal.ansiBrightBlue: 'BrightBlue' ansi color in the terminal. + if (colorSet.terminal.brightBlue) theme.colors['terminal.ansiBrightBlue'] = colorSet.terminal.brightBlue; // terminal.ansiBrightCyan: 'BrightCyan' ansi color in the terminal. + if (colorSet.terminal.brightCyan) theme.colors['terminal.ansiBrightCyan'] = colorSet.terminal.brightCyan; // terminal.ansiBrightGreen: 'BrightGreen' ansi color in the terminal. + if (colorSet.terminal.brightGreen) theme.colors['terminal.ansiBrightGreen'] = colorSet.terminal.brightGreen; // terminal.ansiBrightMagenta: 'BrightMagenta' ansi color in the terminal. + if (colorSet.terminal.brightMagenta) theme.colors['terminal.ansiBrightMagenta'] = colorSet.terminal.brightMagenta; // terminal.ansiBrightRed: 'BrightRed' ansi color in the terminal. + if (colorSet.terminal.brightRed) theme.colors['terminal.ansiBrightRed'] = colorSet.terminal.brightRed; // terminal.ansiBrightWhite: 'BrightWhite' ansi color in the terminal. + if (colorSet.terminal.brightWhite) theme.colors['terminal.ansiBrightWhite'] = colorSet.terminal.brightWhite; // terminal.ansiBrightYellow: 'BrightYellow' ansi color in the terminal. + if (colorSet.terminal.brightYellow) theme.colors['terminal.ansiBrightYellow'] = colorSet.terminal.brightYellow; // terminal.ansiCyan: 'Cyan' ansi color in the terminal. + if (colorSet.terminal.cyan) theme.colors['terminal.ansiCyan'] = colorSet.terminal.cyan; // terminal.ansiGreen: 'Green' ansi color in the terminal. + if (colorSet.terminal.green) theme.colors['terminal.ansiGreen'] = colorSet.terminal.green; // terminal.ansiMagenta: 'Magenta' ansi color in the terminal. + if (colorSet.terminal.magenta) theme.colors['terminal.ansiMagenta'] = colorSet.terminal.magenta; // terminal.ansiRed: 'Red' ansi color in the terminal. + if (colorSet.terminal.red) theme.colors['terminal.ansiRed'] = colorSet.terminal.red; // terminal.ansiWhite: 'White' ansi color in the terminal. + if (colorSet.terminal.white) theme.colors['terminal.ansiWhite'] = colorSet.terminal.white; // terminal.ansiYellow: 'Yellow' ansi color in the terminal. + if (colorSet.terminal.yellow) theme.colors['terminal.ansiYellow'] = colorSet.terminal.yellow; // Debug // debugToolBar.background: Debug toolbar background color.