From 4b98001e71e3090f56aa95fa0ce8e9dfd7d24056 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 28 Feb 2023 05:38:02 -0800 Subject: [PATCH] Register a new color instead of theme participant Part of #165169 --- .../contrib/terminal/browser/media/terminal.css | 4 ++++ .../terminal/browser/widgets/terminalHoverWidget.ts | 12 ------------ .../contrib/terminal/common/terminalColorRegistry.ts | 8 +++++++- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/vs/workbench/contrib/terminal/browser/media/terminal.css b/src/vs/workbench/contrib/terminal/browser/media/terminal.css index bfbc7c32ea5e7..e53b7889c7808 100644 --- a/src/vs/workbench/contrib/terminal/browser/media/terminal.css +++ b/src/vs/workbench/contrib/terminal/browser/media/terminal.css @@ -523,6 +523,10 @@ background-color: var(--vscode-scrollbarSlider-background) !important; } +.monaco-workbench .integrated-terminal .hoverHighlight { + background-color: var(--vscode-terminal-hoverHighlightBackground); +} + .monaco-workbench .editor-instance .xterm-viewport, .monaco-workbench .pane-body.integrated-terminal .xterm-viewport { scrollbar-color: var(--vscode-scrollbarSlider-background) transparent; diff --git a/src/vs/workbench/contrib/terminal/browser/widgets/terminalHoverWidget.ts b/src/vs/workbench/contrib/terminal/browser/widgets/terminalHoverWidget.ts index 6e7dfe8580986..c2de2c4d1d6a1 100644 --- a/src/vs/workbench/contrib/terminal/browser/widgets/terminalHoverWidget.ts +++ b/src/vs/workbench/contrib/terminal/browser/widgets/terminalHoverWidget.ts @@ -10,8 +10,6 @@ import { ITerminalWidget } from 'vs/workbench/contrib/terminal/browser/widgets/w import * as dom from 'vs/base/browser/dom'; import type { IViewportRange } from 'xterm'; import { IHoverTarget, IHoverService, IHoverAction } from 'vs/workbench/services/hover/browser/hover'; -import { registerThemingParticipant } from 'vs/platform/theme/common/themeService'; -import { editorHoverHighlight } from 'vs/platform/theme/common/colorRegistry'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { TerminalSettingId } from 'vs/platform/terminal/common/terminal'; @@ -131,13 +129,3 @@ class CellHoverTarget extends Widget implements IHoverTarget { super.dispose(); } } - -registerThemingParticipant((theme, collector) => { - let editorHoverHighlightColor = theme.getColor(editorHoverHighlight); - if (editorHoverHighlightColor) { - if (editorHoverHighlightColor.isOpaque()) { - editorHoverHighlightColor = editorHoverHighlightColor.transparent(0.5); - } - collector.addRule(`.integrated-terminal .hoverHighlight { background-color: ${editorHoverHighlightColor}; }`); - } -}); diff --git a/src/vs/workbench/contrib/terminal/common/terminalColorRegistry.ts b/src/vs/workbench/contrib/terminal/common/terminalColorRegistry.ts index b0c5917b454d9..5c6dfbeaf386c 100644 --- a/src/vs/workbench/contrib/terminal/common/terminalColorRegistry.ts +++ b/src/vs/workbench/contrib/terminal/common/terminalColorRegistry.ts @@ -5,7 +5,7 @@ import * as nls from 'vs/nls'; -import { registerColor, ColorIdentifier, ColorDefaults, editorFindMatch, editorFindMatchHighlight, overviewRulerFindMatchForeground, editorSelectionBackground, transparent } from 'vs/platform/theme/common/colorRegistry'; +import { registerColor, ColorIdentifier, ColorDefaults, editorFindMatch, editorFindMatchHighlight, overviewRulerFindMatchForeground, editorSelectionBackground, transparent, editorHoverHighlight } from 'vs/platform/theme/common/colorRegistry'; import { EDITOR_DRAG_AND_DROP_BACKGROUND, PANEL_BORDER, TAB_ACTIVE_BORDER } from 'vs/workbench/common/theme'; /** @@ -78,6 +78,12 @@ export const TERMINAL_FIND_MATCH_BACKGROUND_COLOR = registerColor('terminal.find hcDark: null, hcLight: '#0F4A85' }, nls.localize('terminal.findMatchBackground', 'Color of the current search match in the terminal. The color must not be opaque so as not to hide underlying terminal content.')); +export const TERMINAL_HOVER_HIGHLIGHT_BACKGROUND_COLOR = registerColor('terminal.hoverHighlightBackground', { + dark: transparent(editorHoverHighlight, 0.5), + light: transparent(editorHoverHighlight, 0.5), + hcDark: transparent(editorHoverHighlight, 0.5), + hcLight: transparent(editorHoverHighlight, 0.5) +}, nls.localize('terminal.findMatchHighlightBorder', 'Border color of the other search matches in the terminal.')); export const TERMINAL_FIND_MATCH_BORDER_COLOR = registerColor('terminal.findMatchBorder', { dark: null, light: null,