More work on new theme colors, darken slightly

This commit is contained in:
Daniel Imms
2017-03-22 21:52:25 -07:00
parent e64922707d
commit 5112497e6f
2 changed files with 37 additions and 5 deletions

View File

@@ -76,7 +76,7 @@ const sapphireColorSet: IColorSet = {
markdownQuote: '#c0c0c0' markdownQuote: '#c0c0c0'
}, },
ui: { ui: {
background: '#151B24', background: '#12171f',
foreground: '#efefef', foreground: '#efefef',
accent: '#0a0d12', accent: '#0a0d12',
cursor: '#ffffff', cursor: '#ffffff',

View File

@@ -99,7 +99,6 @@ const vscodeJsonGlobalThemeRules: IRuleGenerator[] = [
]; ];
const vscodeColorRules: IRuleGenerator[] = [ const vscodeColorRules: IRuleGenerator[] = [
{ source: set => set.ui.background, generate: getGlobalSettingGenerator('editorBackground') }, { source: set => set.ui.background, generate: getGlobalSettingGenerator('editorBackground') },
{ source: set => set.ui.foreground, generate: getGlobalSettingGenerator('editorForeground') }, { source: set => set.ui.foreground, generate: getGlobalSettingGenerator('editorForeground') },
{ source: set => set.ui.cursor, generate: getGlobalSettingGenerator('editorCaret') }, { source: set => set.ui.cursor, generate: getGlobalSettingGenerator('editorCaret') },
@@ -259,11 +258,44 @@ export class VscodeThemeGenerator implements IThemeGenerator {
} }
}); });
if (colorSet.ui.accent) { if (colorSet.ui.background) {
theme.colors['statusBarBackground'] = colorSet.ui.accent; theme.colors['tabsContainerBackground'] = this._lighten(colorSet.ui.background, 0.2);
theme.colors['inactiveTabBackground'] = this._lighten(colorSet.ui.background, 0.4);
theme.colors['sideBarBackground'] = this._lighten(colorSet.ui.background, 0.2);
theme.colors['panelBackground'] = this._lighten(colorSet.ui.background, 0.2);
theme.colors['activityBarBackground'] = this._lighten(colorSet.ui.background, 0.4);
theme.colors['statusBarBackground'] = this._darken(colorSet.ui.background, 0.2);
// Peek editor
theme.colors['editorPeekEditorBackground'] = this._darken(colorSet.ui.background, 0.2);
} }
theme.colors['tabsContainerBackground'] = colorSet.ui.accent;;
return JSON.stringify(theme); return JSON.stringify(theme);
} }
private _lighten(color: string, amount: number): string {
const MAX = 255;
let r = parseInt(color.substr(1, 2), 16);
let g = parseInt(color.substr(3, 2), 16);
let b = parseInt(color.substr(5, 2), 16);
r = Math.floor(r + (r * amount));
g = Math.floor(g + (g * amount));
b = Math.floor(b + (b * amount));
let rs = r.toString(16);
if (rs.length === 1) {
rs = '0' + rs;
}
let gs = g.toString(16);
if (gs.length === 1) {
gs = '0' + gs;
}
let bs = b.toString(16);
if (bs.length === 1) {
bs = '0' + bs;
}
return `#${rs}${gs}${bs}`;
}
private _darken(color: string, amount: number): string {
return this._lighten(color, -amount);
}
} }