提交 3edd565a 编写于 作者: M Martin Aeschlimann

Add editorSuggestFocusBackground and editorSuggestForegroundColor . Fixes #25522

上级 a3022cf2
...@@ -29,7 +29,7 @@ import { alert } from 'vs/base/browser/ui/aria/aria'; ...@@ -29,7 +29,7 @@ import { alert } from 'vs/base/browser/ui/aria/aria';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { attachListStyler } from 'vs/platform/theme/common/styler'; import { attachListStyler } from 'vs/platform/theme/common/styler';
import { IThemeService, ITheme, registerThemingParticipant } from 'vs/platform/theme/common/themeService'; 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 const sticky = false; // for development purposes
...@@ -49,6 +49,10 @@ interface ISuggestionTemplateData { ...@@ -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 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 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; 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) { function matchesColor(text: string) {
...@@ -383,7 +387,10 @@ export class SuggestWidget implements IContentWidget, IDelegate<ICompletionItem> ...@@ -383,7 +387,10 @@ export class SuggestWidget implements IContentWidget, IDelegate<ICompletionItem>
}); });
this.toDispose = [ this.toDispose = [
attachListStyler(this.list, themeService, { listInactiveFocusBackground: listFocusBackground, listInactiveFocusOutline: activeContrastBorder }), attachListStyler(this.list, themeService, {
listInactiveFocusBackground: editorSuggestWidgetSelectedBackground,
listInactiveFocusOutline: activeContrastBorder
}),
themeService.onThemeChange(t => this.onThemeChange(t)), themeService.onThemeChange(t => this.onThemeChange(t)),
editor.onDidBlurEditorText(() => this.onEditorBlur()), editor.onDidBlurEditorText(() => this.onEditorBlur()),
this.list.onSelectionChange(e => this.onListSelection(e)), this.list.onSelectionChange(e => this.onListSelection(e)),
...@@ -925,8 +932,12 @@ export class SuggestWidget implements IContentWidget, IDelegate<ICompletionItem> ...@@ -925,8 +932,12 @@ export class SuggestWidget implements IContentWidget, IDelegate<ICompletionItem>
} }
registerThemingParticipant((theme, collector) => { registerThemingParticipant((theme, collector) => {
let matchHighlight = theme.getColor(listHighlightForeground); let matchHighlight = theme.getColor(editorSuggestWidgetHighlightForeground);
if (matchHighlight) { if (matchHighlight) {
collector.addRule(`.monaco-editor.${theme.selector} .suggest-widget:not(.frozen) .monaco-highlighted-label .highlight { color: ${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}; }`);
}
}); });
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册