Skip to content

Commit 59ffb07

Browse files
committed
support editorHoverWidget.foreground. Fixes microsoft#65170
1 parent fc6ae20 commit 59ffb07

6 files changed

Lines changed: 26 additions & 8 deletions

File tree

src/vs/editor/contrib/hover/hover.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { ModesContentHoverWidget } from 'vs/editor/contrib/hover/modesContentHov
2121
import { ModesGlyphHoverWidget } from 'vs/editor/contrib/hover/modesGlyphHover';
2222
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
2323
import { IOpenerService } from 'vs/platform/opener/common/opener';
24-
import { editorHoverBackground, editorHoverBorder, editorHoverHighlight, textCodeBlockBackground, textLinkForeground, editorHoverStatusBarBackground } from 'vs/platform/theme/common/colorRegistry';
24+
import { editorHoverBackground, editorHoverBorder, editorHoverHighlight, textCodeBlockBackground, textLinkForeground, editorHoverStatusBarBackground, editorHoverForeground } from 'vs/platform/theme/common/colorRegistry';
2525
import { IThemeService, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
2626
import { IMarkerDecorationsService } from 'vs/editor/common/services/markersDecorationService';
2727
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
@@ -282,6 +282,10 @@ registerThemingParticipant((theme, collector) => {
282282
if (link) {
283283
collector.addRule(`.monaco-editor .monaco-editor-hover a { color: ${link}; }`);
284284
}
285+
const hoverForeground = theme.getColor(editorHoverForeground);
286+
if (hoverForeground) {
287+
collector.addRule(`.monaco-editor .monaco-editor-hover { color: ${hoverForeground}; }`);
288+
}
285289
const actionsBackground = theme.getColor(editorHoverStatusBarBackground);
286290
if (actionsBackground) {
287291
collector.addRule(`.monaco-editor .monaco-editor-hover .hover-row .actions { background-color: ${actionsBackground}; }`);

src/vs/editor/contrib/parameterHints/parameterHintsWidget.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { Context } from 'vs/editor/contrib/parameterHints/provideSignatureHelp';
1919
import * as nls from 'vs/nls';
2020
import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
2121
import { IOpenerService } from 'vs/platform/opener/common/opener';
22-
import { editorHoverBackground, editorHoverBorder, textCodeBlockBackground, textLinkForeground } from 'vs/platform/theme/common/colorRegistry';
22+
import { editorHoverBackground, editorHoverBorder, textCodeBlockBackground, textLinkForeground, editorHoverForeground } from 'vs/platform/theme/common/colorRegistry';
2323
import { HIGH_CONTRAST, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
2424
import { ParameterHintsModel, TriggerContext } from 'vs/editor/contrib/parameterHints/parameterHintsModel';
2525

@@ -377,6 +377,11 @@ registerThemingParticipant((theme, collector) => {
377377
collector.addRule(`.monaco-editor .parameter-hints-widget a { color: ${link}; }`);
378378
}
379379

380+
const foreground = theme.getColor(editorHoverForeground);
381+
if (foreground) {
382+
collector.addRule(`.monaco-editor .parameter-hints-widget { color: ${foreground}; }`);
383+
}
384+
380385
const codeBackground = theme.getColor(textCodeBlockBackground);
381386
if (codeBackground) {
382387
collector.addRule(`.monaco-editor .parameter-hints-widget code { background-color: ${codeBackground}; }`);

src/vs/editor/standalone/browser/inspectTokens/inspectTokens.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { FontStyle, IState, ITokenizationSupport, LanguageIdentifier, StandardTo
1818
import { NULL_STATE, nullTokenize, nullTokenize2 } from 'vs/editor/common/modes/nullMode';
1919
import { IModeService } from 'vs/editor/common/services/modeService';
2020
import { IStandaloneThemeService } from 'vs/editor/standalone/common/standaloneThemeService';
21-
import { editorHoverBackground, editorHoverBorder } from 'vs/platform/theme/common/colorRegistry';
21+
import { editorHoverBackground, editorHoverBorder, editorHoverForeground } from 'vs/platform/theme/common/colorRegistry';
2222
import { HIGH_CONTRAST, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
2323
import { InspectTokensNLS } from 'vs/editor/common/standaloneStrings';
2424

@@ -335,4 +335,8 @@ registerThemingParticipant((theme, collector) => {
335335
if (background) {
336336
collector.addRule(`.monaco-editor .tokens-inspect-widget { background-color: ${background}; }`);
337337
}
338+
const foreground = theme.getColor(editorHoverForeground);
339+
if (foreground) {
340+
collector.addRule(`.monaco-editor .tokens-inspect-widget { color: ${foreground}; }`);
341+
}
338342
});

src/vs/platform/theme/common/colorRegistry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,9 +304,9 @@ export const editorFindRangeHighlightBorder = registerColor('editor.findRangeHig
304304
*/
305305
export const editorHoverHighlight = registerColor('editor.hoverHighlightBackground', { light: '#ADD6FF26', dark: '#264f7840', hc: '#ADD6FF26' }, nls.localize('hoverHighlight', 'Highlight below the word for which a hover is shown. The color must not be opaque so as not to hide underlying decorations.'), true);
306306
export const editorHoverBackground = registerColor('editorHoverWidget.background', { light: editorWidgetBackground, dark: editorWidgetBackground, hc: editorWidgetBackground }, nls.localize('hoverBackground', 'Background color of the editor hover.'));
307+
export const editorHoverForeground = registerColor('editorHoverWidget.foreground', { light: editorWidgetForeground, dark: editorWidgetForeground, hc: editorWidgetForeground }, nls.localize('hoverForeground', 'Foreground color of the editor hover.'));
307308
export const editorHoverBorder = registerColor('editorHoverWidget.border', { light: editorWidgetBorder, dark: editorWidgetBorder, hc: editorWidgetBorder }, nls.localize('hoverBorder', 'Border color of the editor hover.'));
308309
export const editorHoverStatusBarBackground = registerColor('editorHoverWidget.statusBarBackground', { dark: lighten(editorHoverBackground, 0.2), light: darken(editorHoverBackground, 0.05), hc: editorWidgetBackground }, nls.localize('statusBarBackground', "Background color of the editor hover status bar."));
309-
310310
/**
311311
* Editor link colors
312312
*/

src/vs/workbench/contrib/debug/browser/debugHover.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { renderExpressionValue, replaceWhitespace } from 'vs/workbench/contrib/d
2020
import { DomScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableElement';
2121
import { attachStylerCallback } from 'vs/platform/theme/common/styler';
2222
import { IThemeService } from 'vs/platform/theme/common/themeService';
23-
import { editorHoverBackground, editorHoverBorder } from 'vs/platform/theme/common/colorRegistry';
23+
import { editorHoverBackground, editorHoverBorder, editorHoverForeground } from 'vs/platform/theme/common/colorRegistry';
2424
import { ModelDecorationOptions } from 'vs/editor/common/model/textModel';
2525
import { getExactExpressionStartAndEnd } from 'vs/workbench/contrib/debug/common/debugUtils';
2626
import { AsyncDataTree } from 'vs/base/browser/ui/tree/asyncDataTree';
@@ -90,7 +90,7 @@ export class DebugHoverWidget implements IContentWidget {
9090

9191
this.editor.applyFontInfo(this.domNode);
9292

93-
this.toDispose.push(attachStylerCallback(this.themeService, { editorHoverBackground, editorHoverBorder }, colors => {
93+
this.toDispose.push(attachStylerCallback(this.themeService, { editorHoverBackground, editorHoverBorder, editorHoverForeground }, colors => {
9494
if (colors.editorHoverBackground) {
9595
this.domNode.style.backgroundColor = colors.editorHoverBackground.toString();
9696
} else {
@@ -101,6 +101,11 @@ export class DebugHoverWidget implements IContentWidget {
101101
} else {
102102
this.domNode.style.border = '';
103103
}
104+
if (colors.editorHoverForeground) {
105+
this.domNode.style.color = colors.editorHoverForeground.toString();
106+
} else {
107+
this.domNode.style.color = null;
108+
}
104109
}));
105110
this.toDispose.push(this.tree.onDidChangeContentHeight(() => this.layoutTreeAndContainer()));
106111

src/vs/workbench/contrib/terminal/browser/terminalPanel.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
1515
import { TERMINAL_PANEL_ID } from 'vs/workbench/contrib/terminal/common/terminal';
1616
import { IThemeService, ITheme, registerThemingParticipant, ICssStyleCollector } from 'vs/platform/theme/common/themeService';
1717
import { TerminalFindWidget } from 'vs/workbench/contrib/terminal/browser/terminalFindWidget';
18-
import { editorHoverBackground, editorHoverBorder, editorForeground } from 'vs/platform/theme/common/colorRegistry';
18+
import { editorHoverBackground, editorHoverBorder, editorHoverForeground } from 'vs/platform/theme/common/colorRegistry';
1919
import { KillTerminalAction, SwitchTerminalAction, SwitchTerminalActionViewItem, CopyTerminalSelectionAction, TerminalPasteAction, ClearTerminalAction, SelectAllTerminalAction, CreateNewTerminalAction, SplitTerminalAction } from 'vs/workbench/contrib/terminal/browser/terminalActions';
2020
import { Panel } from 'vs/workbench/browser/panel';
2121
import { StandardMouseEvent } from 'vs/base/browser/mouseEvent';
@@ -338,7 +338,7 @@ registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => {
338338
if (hoverBorder) {
339339
collector.addRule(`.monaco-workbench .panel.integrated-terminal .terminal-message-widget { border: 1px solid ${hoverBorder}; }`);
340340
}
341-
const hoverForeground = theme.getColor(editorForeground);
341+
const hoverForeground = theme.getColor(editorHoverForeground);
342342
if (hoverForeground) {
343343
collector.addRule(`.monaco-workbench .panel.integrated-terminal .terminal-message-widget { color: ${hoverForeground}; }`);
344344
}

0 commit comments

Comments
 (0)