From 2b73072d2e960ea5f7776ec3085f7955015742c9 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Fri, 28 Apr 2017 20:03:39 +0200 Subject: [PATCH] theme - get rid of list.focusAndSelectionBackground --- .../theme-abyss/themes/abyss-color-theme.json | 1 - .../themes/dimmed-monokai-color-theme.json | 1 - .../theme-monokai/themes/monokai-color-theme.json | 1 - .../themes/quietlight-color-theme.json | 1 - extensions/theme-red/themes/Red-color-theme.json | 1 - .../themes/solarized-dark-color-theme.json | 1 - .../themes/tomorrow-night-blue-theme.json | 1 - src/vs/platform/theme/common/colorRegistry.ts | 1 - src/vs/platform/theme/common/styler.ts | 15 ++++++++++----- 9 files changed, 10 insertions(+), 13 deletions(-) diff --git a/extensions/theme-abyss/themes/abyss-color-theme.json b/extensions/theme-abyss/themes/abyss-color-theme.json index 0fe1453410b0..03c19413808c 100644 --- a/extensions/theme-abyss/themes/abyss-color-theme.json +++ b/extensions/theme-abyss/themes/abyss-color-theme.json @@ -276,7 +276,6 @@ "button.hoverBackground": "#4A5C6B", // "button.foreground": "", - "list.focusAndSelectionBackground": "#08286b", "list.activeSelectionBackground": "#011B51", // "list.activeSelectionForeground": "", "list.focusBackground": "#08286b", diff --git a/extensions/theme-monokai-dimmed/themes/dimmed-monokai-color-theme.json b/extensions/theme-monokai-dimmed/themes/dimmed-monokai-color-theme.json index 15410dcf938b..173c9283c4eb 100644 --- a/extensions/theme-monokai-dimmed/themes/dimmed-monokai-color-theme.json +++ b/extensions/theme-monokai-dimmed/themes/dimmed-monokai-color-theme.json @@ -5,7 +5,6 @@ // "focusBorder": "#00f9ff", "dropdown.background": "#383852", "list.activeSelectionBackground": "#303050", - "list.focusAndSelectionBackground": "#383852", "list.inactiveSelectionBackground": "#303d45", "list.hoverBackground": "#005070", "list.dropBackground": "#505590", diff --git a/extensions/theme-monokai/themes/monokai-color-theme.json b/extensions/theme-monokai/themes/monokai-color-theme.json index c9c0ff57dc3d..74d3acac33d2 100644 --- a/extensions/theme-monokai/themes/monokai-color-theme.json +++ b/extensions/theme-monokai/themes/monokai-color-theme.json @@ -6,7 +6,6 @@ "dropdown.background": "#383852", "list.activeSelectionBackground": "#303070", "list.focusBackground": "#394770", - "list.focusAndSelectionBackground": "#383852", "list.inactiveSelectionBackground": "#303d45", "list.hoverBackground": "#005070", "list.dropBackground": "#505590", diff --git a/extensions/theme-quietlight/themes/quietlight-color-theme.json b/extensions/theme-quietlight/themes/quietlight-color-theme.json index 5b6e6e8cbab8..e33c477a18ba 100644 --- a/extensions/theme-quietlight/themes/quietlight-color-theme.json +++ b/extensions/theme-quietlight/themes/quietlight-color-theme.json @@ -458,7 +458,6 @@ "pickerGroup.border": "#749351", "list.activeSelectionForeground": "#6c6c6c", "list.focusBackground": "#CADEB9", - "list.focusAndSelectionBackground": "#A2B294", "list.activeSelectionBackground": "#B6C8A7", "editor.background": "#F5F5F5", "editorWhitespace.foreground": "#AAAAAA", diff --git a/extensions/theme-red/themes/Red-color-theme.json b/extensions/theme-red/themes/Red-color-theme.json index ecba98b7b0ab..55372ceb608e 100644 --- a/extensions/theme-red/themes/Red-color-theme.json +++ b/extensions/theme-red/themes/Red-color-theme.json @@ -47,7 +47,6 @@ "list.activeSelectionBackground": "#700000", "list.inactiveSelectionBackground": "#770000", "list.focusBackground": "#660000", - "list.focusAndSelectionBackground": "#880000", "list.highlightForeground": "#ff4444", "notification.background": "#662222", "pickerGroup.foreground": "#cc9999", diff --git a/extensions/theme-solarized-dark/themes/solarized-dark-color-theme.json b/extensions/theme-solarized-dark/themes/solarized-dark-color-theme.json index bbf6457db31a..116bdf1705ab 100644 --- a/extensions/theme-solarized-dark/themes/solarized-dark-color-theme.json +++ b/extensions/theme-solarized-dark/themes/solarized-dark-color-theme.json @@ -316,7 +316,6 @@ "button.hoverBackground": "#2AA19844", // "button.foreground": "", - "list.focusAndSelectionBackground": "#005A6F", "list.activeSelectionBackground": "#004454", // "list.activeSelectionForeground": "", "list.focusBackground": "#005A6F", diff --git a/extensions/theme-tomorrow-night-blue/themes/tomorrow-night-blue-theme.json b/extensions/theme-tomorrow-night-blue/themes/tomorrow-night-blue-theme.json index 5510699e5397..a2d815a46a11 100644 --- a/extensions/theme-tomorrow-night-blue/themes/tomorrow-night-blue-theme.json +++ b/extensions/theme-tomorrow-night-blue/themes/tomorrow-night-blue-theme.json @@ -6,7 +6,6 @@ "dropdown.background": "#001733", "list.focusBackground": "#ffffff60", "list.activeSelectionBackground": "#ffffff50", - "list.focusAndSelectionBackground": "#ffffff60", "list.inactiveSelectionBackground": "#ffffff40", "list.hoverBackground": "#ffffff30", "list.dropBackground": "#ffffff60", diff --git a/src/vs/platform/theme/common/colorRegistry.ts b/src/vs/platform/theme/common/colorRegistry.ts index fc9d6c00f6a4..4ffdf7b94e38 100644 --- a/src/vs/platform/theme/common/colorRegistry.ts +++ b/src/vs/platform/theme/common/colorRegistry.ts @@ -147,7 +147,6 @@ export const listFocusBackground = registerColor('list.focusBackground', { dark: export const listActiveSelectionBackground = registerColor('list.activeSelectionBackground', { dark: '#0E639C', light: '#4FA7FF', hc: null }, nls.localize('listActiveSelectionBackground', "List/Tree background color for the selected item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.")); export const listInactiveSelectionBackground = registerColor('list.inactiveSelectionBackground', { dark: '#3F3F46', light: '#CCCEDB', hc: null }, nls.localize('listInactiveSelectionBackground', "List/Tree background color for the selected item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.")); export const listActiveSelectionForeground = registerColor('list.activeSelectionForeground', { dark: Color.white, light: Color.white, hc: Color.white }, nls.localize('listActiveSelectionForeground', "List/Tree foreground color for the selected item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.")); -export const listFocusAndSelectionBackground = registerColor('list.focusAndSelectionBackground', { dark: '#094771', light: '#3399FF', hc: null }, nls.localize('listFocusAndSelectionBackground', "List/Tree background color for the focused and selected item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not. This color wins over the individual selection and focus colors.")); export const listHoverBackground = registerColor('list.hoverBackground', { dark: '#2A2D2E', light: '#F0F0F0', hc: null }, nls.localize('listHoverBackground', "List/Tree background when hovering over items using the mouse.")); export const listDropBackground = registerColor('list.dropBackground', { dark: '#383B3D', light: '#DDECFF', hc: null }, nls.localize('listDropBackground', "List/Tree drag and drop background when moving items around using the mouse.")); export const listHighlightForeground = registerColor('list.highlightForeground', { dark: '#219AE4', light: '#186B9E', hc: '#219AE4' }, nls.localize('highlight', 'List/Tree foreground color of the match highlights when searching inside the list/tree.')); diff --git a/src/vs/platform/theme/common/styler.ts b/src/vs/platform/theme/common/styler.ts index 8af56194dea0..22ec31faf2ab 100644 --- a/src/vs/platform/theme/common/styler.ts +++ b/src/vs/platform/theme/common/styler.ts @@ -6,7 +6,7 @@ 'use strict'; import { ITheme, IThemeService } from 'vs/platform/theme/common/themeService'; -import { inputBackground, inputForeground, ColorIdentifier, selectForeground, selectBackground, selectBorder, inputBorder, foreground, editorBackground, contrastBorder, inputActiveOptionBorder, listFocusBackground, listActiveSelectionBackground, listActiveSelectionForeground, listFocusAndSelectionBackground, listInactiveSelectionBackground, listHoverBackground, listDropBackground, pickerGroupBorder, pickerGroupForeground, widgetShadow, inputValidationInfoBorder, inputValidationInfoBackground, inputValidationWarningBorder, inputValidationWarningBackground, inputValidationErrorBorder, inputValidationErrorBackground, activeContrastBorder, buttonForeground, buttonBackground, buttonHoverBackground } from 'vs/platform/theme/common/colorRegistry'; +import { inputBackground, inputForeground, ColorIdentifier, selectForeground, selectBackground, selectBorder, inputBorder, foreground, editorBackground, contrastBorder, inputActiveOptionBorder, listFocusBackground, listActiveSelectionBackground, listActiveSelectionForeground, listInactiveSelectionBackground, listHoverBackground, listDropBackground, pickerGroupBorder, pickerGroupForeground, widgetShadow, inputValidationInfoBorder, inputValidationInfoBackground, inputValidationWarningBorder, inputValidationWarningBackground, inputValidationErrorBorder, inputValidationErrorBackground, activeContrastBorder, buttonForeground, buttonBackground, buttonHoverBackground, ColorFunction, darken } from 'vs/platform/theme/common/colorRegistry'; import { IDisposable } from 'vs/base/common/lifecycle'; import { SIDE_BAR_SECTION_HEADER_BACKGROUND } from 'vs/workbench/common/theme'; @@ -14,11 +14,16 @@ export interface IThemable { style(colors: { [name: string]: ColorIdentifier }): void; } -export function attachStyler(themeService: IThemeService, widget: IThemable, optionsMapping: { [optionsKey: string]: ColorIdentifier }): IDisposable { +export function attachStyler(themeService: IThemeService, widget: IThemable, optionsMapping: { [optionsKey: string]: ColorIdentifier | ColorFunction }): IDisposable { function applyStyles(theme: ITheme): void { const styles = Object.create(null); for (let key in optionsMapping) { - styles[key] = theme.getColor(optionsMapping[key]); + const value = optionsMapping[key]; + if (typeof value === 'string') { + styles[key] = theme.getColor(value); + } else if (typeof value === 'function') { + styles[key] = value(theme); + } } widget.style(styles); @@ -142,7 +147,7 @@ export function attachQuickOpenStyler(widget: IThemable, themeService: IThemeSer listFocusBackground: (style && style.listFocusBackground) || listFocusBackground, listActiveSelectionBackground: (style && style.listActiveSelectionBackground) || listActiveSelectionBackground, listActiveSelectionForeground: (style && style.listActiveSelectionForeground) || listActiveSelectionForeground, - listFocusAndSelectionBackground: (style && style.listFocusAndSelectionBackground) || listFocusAndSelectionBackground, + listFocusAndSelectionBackground: style && style.listFocusAndSelectionBackground || darken(listActiveSelectionBackground, 0.1), listFocusAndSelectionForeground: (style && style.listFocusAndSelectionForeground) || listActiveSelectionForeground, listInactiveSelectionBackground: (style && style.listInactiveSelectionBackground) || listInactiveSelectionBackground, listHoverBackground: (style && style.listHoverBackground) || listHoverBackground, @@ -172,7 +177,7 @@ export function attachListStyler(widget: IThemable, themeService: IThemeService, listFocusBackground: (style && style.listFocusBackground) || listFocusBackground, listActiveSelectionBackground: (style && style.listActiveSelectionBackground) || listActiveSelectionBackground, listActiveSelectionForeground: (style && style.listActiveSelectionForeground) || listActiveSelectionForeground, - listFocusAndSelectionBackground: (style && style.listFocusAndSelectionBackground) || listFocusAndSelectionBackground, + listFocusAndSelectionBackground: style && style.listFocusAndSelectionBackground || darken(listActiveSelectionBackground, 0.1), listFocusAndSelectionForeground: (style && style.listFocusAndSelectionForeground) || listActiveSelectionForeground, listInactiveFocusBackground: (style && style.listInactiveFocusBackground), listInactiveSelectionBackground: (style && style.listInactiveSelectionBackground) || listInactiveSelectionBackground,