Skip to content

Commit 8df188a

Browse files
Kalmaegiaeschli
andauthored
microsoft#165169 Move css rules from hover.ts into hover.css (microsoft#166095)
* microsoft#165169 Move css rules from hover.ts into hover.css * Move hover css rules to the appropriate location * Delete redundant lines * add css import Co-authored-by: Martin Aeschlimann <[email protected]>
1 parent bd32dd5 commit 8df188a

File tree

2 files changed

+34
-30
lines changed

2 files changed

+34
-30
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
.monaco-editor .hoverHighlight {
7+
background-color: var(--vscode-editor-hoverHighlightBackground);
8+
}
9+
10+
.monaco-editor .monaco-hover {
11+
color: var(--vscode-editorHoverWidget-foreground);
12+
background-color: var(--vscode-editorHoverWidget-background);
13+
border: 1px solid var(--vscode-editorHoverWidget-border);
14+
}
15+
16+
.monaco-editor .monaco-hover a {
17+
color: var(--vscode-textLink-foreground);
18+
}
19+
20+
.monaco-editor .monaco-hover a:hover {
21+
color: var(--vscode-textLink-activeForeground);
22+
}
23+
24+
.monaco-editor .monaco-hover .hover-row .actions {
25+
background-color: var(--vscode-editorHoverWidget-statusBarBackground);
26+
}
27+
28+
.monaco-editor .monaco-hover code {
29+
background-color: var(--vscode-textCodeBlock-background);
30+
}
31+
32+

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

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@ import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
2323
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
2424
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
2525
import { IOpenerService } from 'vs/platform/opener/common/opener';
26-
import { editorHoverBackground, editorHoverBorder, editorHoverForeground, editorHoverHighlight, editorHoverStatusBarBackground, textCodeBlockBackground, textLinkActiveForeground, textLinkForeground } from 'vs/platform/theme/common/colorRegistry';
26+
import { editorHoverBorder } from 'vs/platform/theme/common/colorRegistry';
2727
import { registerThemingParticipant } from 'vs/platform/theme/common/themeService';
2828
import { HoverParticipantRegistry } from 'vs/editor/contrib/hover/browser/hoverTypes';
2929
import { MarkdownHoverParticipant } from 'vs/editor/contrib/hover/browser/markdownHoverParticipant';
3030
import { MarkerHoverParticipant } from 'vs/editor/contrib/hover/browser/markerHoverParticipant';
31+
import 'vs/css!./hover';
3132

3233
export class ModesHoverController implements IEditorContribution {
3334

@@ -322,39 +323,10 @@ HoverParticipantRegistry.register(MarkerHoverParticipant);
322323

323324
// theming
324325
registerThemingParticipant((theme, collector) => {
325-
const editorHoverHighlightColor = theme.getColor(editorHoverHighlight);
326-
if (editorHoverHighlightColor) {
327-
collector.addRule(`.monaco-editor .hoverHighlight { background-color: ${editorHoverHighlightColor}; }`);
328-
}
329-
const hoverBackground = theme.getColor(editorHoverBackground);
330-
if (hoverBackground) {
331-
collector.addRule(`.monaco-editor .monaco-hover { background-color: ${hoverBackground}; }`);
332-
}
333326
const hoverBorder = theme.getColor(editorHoverBorder);
334327
if (hoverBorder) {
335-
collector.addRule(`.monaco-editor .monaco-hover { border: 1px solid ${hoverBorder}; }`);
336328
collector.addRule(`.monaco-editor .monaco-hover .hover-row:not(:first-child):not(:empty) { border-top: 1px solid ${hoverBorder.transparent(0.5)}; }`);
337329
collector.addRule(`.monaco-editor .monaco-hover hr { border-top: 1px solid ${hoverBorder.transparent(0.5)}; }`);
338330
collector.addRule(`.monaco-editor .monaco-hover hr { border-bottom: 0px solid ${hoverBorder.transparent(0.5)}; }`);
339331
}
340-
const link = theme.getColor(textLinkForeground);
341-
if (link) {
342-
collector.addRule(`.monaco-editor .monaco-hover a { color: ${link}; }`);
343-
}
344-
const linkHover = theme.getColor(textLinkActiveForeground);
345-
if (linkHover) {
346-
collector.addRule(`.monaco-editor .monaco-hover a:hover { color: ${linkHover}; }`);
347-
}
348-
const hoverForeground = theme.getColor(editorHoverForeground);
349-
if (hoverForeground) {
350-
collector.addRule(`.monaco-editor .monaco-hover { color: ${hoverForeground}; }`);
351-
}
352-
const actionsBackground = theme.getColor(editorHoverStatusBarBackground);
353-
if (actionsBackground) {
354-
collector.addRule(`.monaco-editor .monaco-hover .hover-row .actions { background-color: ${actionsBackground}; }`);
355-
}
356-
const codeBackground = theme.getColor(textCodeBlockBackground);
357-
if (codeBackground) {
358-
collector.addRule(`.monaco-editor .monaco-hover code { background-color: ${codeBackground}; }`);
359-
}
360332
});

0 commit comments

Comments
 (0)