From 3edd565a4b343642f3684686088e964b2f2da5fb Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Thu, 27 Apr 2017 22:40:48 +0200 Subject: [PATCH] Add editorSuggestFocusBackground and editorSuggestForegroundColor . Fixes #25522 --- .../contrib/suggest/browser/suggestWidget.ts | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/vs/editor/contrib/suggest/browser/suggestWidget.ts b/src/vs/editor/contrib/suggest/browser/suggestWidget.ts index e0d60a890c2..729331aa277 100644 --- a/src/vs/editor/contrib/suggest/browser/suggestWidget.ts +++ b/src/vs/editor/contrib/suggest/browser/suggestWidget.ts @@ -29,7 +29,7 @@ import { alert } from 'vs/base/browser/ui/aria/aria'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { attachListStyler } from 'vs/platform/theme/common/styler'; import { IThemeService, ITheme, registerThemingParticipant } from 'vs/platform/theme/common/themeService'; -import { registerColor, editorWidgetBackground, contrastBorder, listFocusBackground, activeContrastBorder, listHighlightForeground } from 'vs/platform/theme/common/colorRegistry'; +import { registerColor, editorWidgetBackground, contrastBorder, listFocusBackground, activeContrastBorder, listHighlightForeground, editorForeground } from 'vs/platform/theme/common/colorRegistry'; const sticky = false; // for development purposes @@ -49,6 +49,10 @@ interface ISuggestionTemplateData { */ export const editorSuggestWidgetBackground = registerColor('editorSuggestWidgetBackground', { dark: editorWidgetBackground, light: editorWidgetBackground, hc: editorWidgetBackground }, nls.localize('editorSuggestWidgetBackground', 'Background color of the suggest widget.')); export const editorSuggestWidgetBorder = registerColor('editorSuggestWidgetBorder', { dark: '#454545', light: '#C8C8C8', hc: contrastBorder }, nls.localize('editorSuggestWidgetBorder', 'Border color of the suggest widget.')); +export const editorSuggestWidgetForeground = registerColor('editorSuggestWidgetForeground', { dark: editorForeground, light: editorForeground, hc: editorForeground }, nls.localize('editorSuggestWidgetForeground', 'Foreground color of the suggest widget.')); +export const editorSuggestWidgetSelectedBackground = registerColor('editorSuggestWidgetSelectedBackground', { dark: listFocusBackground, light: listFocusBackground, hc: listFocusBackground }, nls.localize('editorSuggestWidgetSelectedBackground', 'Background color of the selected entry in the suggest widget.')); +export const editorSuggestWidgetHighlightForeground = registerColor('editorSuggestWidgetHighlightForeground', { dark: listHighlightForeground, light: listHighlightForeground, hc: listHighlightForeground }, nls.localize('editorSuggestWidgetHighlightForeground', 'Color of the match highlights in the suggest widget.')); + const colorRegExp = /^(#([\da-f]{3}){1,2}|(rgb|hsl)a\(\s*(\d{1,3}%?\s*,\s*){3}(1|0?\.\d+)\)|(rgb|hsl)\(\s*\d{1,3}%?(\s*,\s*\d{1,3}%?){2}\s*\))$/i; function matchesColor(text: string) { @@ -383,7 +387,10 @@ export class SuggestWidget implements IContentWidget, IDelegate }); this.toDispose = [ - attachListStyler(this.list, themeService, { listInactiveFocusBackground: listFocusBackground, listInactiveFocusOutline: activeContrastBorder }), + attachListStyler(this.list, themeService, { + listInactiveFocusBackground: editorSuggestWidgetSelectedBackground, + listInactiveFocusOutline: activeContrastBorder + }), themeService.onThemeChange(t => this.onThemeChange(t)), editor.onDidBlurEditorText(() => this.onEditorBlur()), this.list.onSelectionChange(e => this.onListSelection(e)), @@ -925,8 +932,12 @@ export class SuggestWidget implements IContentWidget, IDelegate } registerThemingParticipant((theme, collector) => { - let matchHighlight = theme.getColor(listHighlightForeground); + let matchHighlight = theme.getColor(editorSuggestWidgetHighlightForeground); if (matchHighlight) { collector.addRule(`.monaco-editor.${theme.selector} .suggest-widget:not(.frozen) .monaco-highlighted-label .highlight { color: ${matchHighlight}; }`); } + let foreground = theme.getColor(editorSuggestWidgetForeground); + if (foreground) { + collector.addRule(`.monaco-editor.${theme.selector} .suggest-widget { color: ${foreground}; }`); + } }); -- GitLab