Adopt css colors in parameter hints widget (#168234)

* Adopt css colors in parameter hints widget

For #165169

* Add opacity to borders
This commit is contained in:
Matt Bierner 2022-12-06 14:47:55 -08:00 committed by GitHub
parent a3ce458be0
commit 23ce9daef8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 47 additions and 59 deletions

View file

@ -10,6 +10,14 @@
flex-direction: column;
line-height: 1.5em;
cursor: default;
color: var(--vscode-editor-hoverForeground);
background-color: var(--vscode-editorHoverWidget-background);
border: 1px solid var(--vscode-editorHoverWidget-border);
}
.hc-black .monaco-editor .parameter-hints-widget,
.hc-light .monaco-editor .parameter-hints-widget {
border-width: 2px;
}
.monaco-editor .parameter-hints-widget > .phwrapper {
@ -23,8 +31,13 @@
padding: 0;
}
.monaco-editor .parameter-hints-widget.visible {
transition: left .05s ease-in-out;
.monaco-editor .parameter-hints-widget.multiple .body::before {
content: "";
display: block;
height: 100%;
position: absolute;
opacity: 0.5;
border-left: 1px solid var(--vscode-editorHoverWidget-border);
}
.monaco-editor .parameter-hints-widget p,
@ -42,6 +55,18 @@
.monaco-editor .parameter-hints-widget .signature {
padding: 4px 5px;
position: relative;
}
.monaco-editor .parameter-hints-widget .signature.has-docs::after {
content: "";
display: block;
position: absolute;
left: 0;
width: 100%;
padding-top: 4px;
opacity: 0.5;
border-bottom: 1px solid var(--vscode-editorHoverWidget-border);
}
.monaco-editor .parameter-hints-widget .docs {
@ -53,26 +78,29 @@
display: none;
}
.monaco-editor .parameter-hints-widget .docs a {
color: var(--vscode-textLink-foreground);
}
.monaco-editor .parameter-hints-widget .docs a:hover {
color: var(--vscode-textLink-activeForeground);
cursor: pointer;
}
.monaco-editor .parameter-hints-widget .docs .markdown-docs {
white-space: initial;
}
.monaco-editor .parameter-hints-widget .docs .markdown-docs a:hover {
cursor: pointer;
}
.monaco-editor .parameter-hints-widget .docs .markdown-docs code {
font-family: var(--monaco-monospace-font);
}
.monaco-editor .parameter-hints-widget .docs .monaco-tokenized-source,
.monaco-editor .parameter-hints-widget .docs .code {
white-space: pre-wrap;
}
.monaco-editor .parameter-hints-widget .docs code {
font-family: var(--monaco-monospace-font);
border-radius: 3px;
padding: 0 0.4em;
background-color: var(--vscode-textCodeBlock-background);
}
.monaco-editor .parameter-hints-widget .docs .monaco-tokenized-source,
.monaco-editor .parameter-hints-widget .docs .code {
white-space: pre-wrap;
}
.monaco-editor .parameter-hints-widget .controls {
@ -107,6 +135,7 @@
}
.monaco-editor .parameter-hints-widget .signature .parameter.active {
color: var(--vscode-editor-hoverHighlightForeground);
font-weight: bold;
}

View file

@ -23,10 +23,9 @@ import { Context } from 'vs/editor/contrib/parameterHints/browser/provideSignatu
import * as nls from 'vs/nls';
import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IOpenerService } from 'vs/platform/opener/common/opener';
import { editorHoverBackground, editorHoverBorder, editorHoverForeground, listHighlightForeground, registerColor, textCodeBlockBackground, textLinkActiveForeground, textLinkForeground } from 'vs/platform/theme/common/colorRegistry';
import { listHighlightForeground, registerColor } from 'vs/platform/theme/common/colorRegistry';
import { registerIcon } from 'vs/platform/theme/common/iconRegistry';
import { isHighContrast } from 'vs/platform/theme/common/theme';
import { registerThemingParticipant, ThemeIcon } from 'vs/platform/theme/common/themeService';
import { ThemeIcon } from 'vs/platform/theme/common/themeService';
const $ = dom.$;
@ -366,44 +365,4 @@ export class ParameterHintsWidget extends Disposable implements IContentWidget {
}
}
const editorHoverWidgetHighlightForeground = registerColor('editorHoverWidget.highlightForeground', { dark: listHighlightForeground, light: listHighlightForeground, hcDark: listHighlightForeground, hcLight: listHighlightForeground }, nls.localize('editorHoverWidgetHighlightForeground', 'Foreground color of the active item in the parameter hint.'));
registerThemingParticipant((theme, collector) => {
const border = theme.getColor(editorHoverBorder);
if (border) {
const borderWidth = isHighContrast(theme.type) ? 2 : 1;
collector.addRule(`.monaco-editor .parameter-hints-widget { border: ${borderWidth}px solid ${border}; }`);
collector.addRule(`.monaco-editor .parameter-hints-widget.multiple .body { border-left: 1px solid ${border.transparent(0.5)}; }`);
collector.addRule(`.monaco-editor .parameter-hints-widget .signature.has-docs { border-bottom: 1px solid ${border.transparent(0.5)}; }`);
}
const background = theme.getColor(editorHoverBackground);
if (background) {
collector.addRule(`.monaco-editor .parameter-hints-widget { background-color: ${background}; }`);
}
const link = theme.getColor(textLinkForeground);
if (link) {
collector.addRule(`.monaco-editor .parameter-hints-widget a { color: ${link}; }`);
}
const linkHover = theme.getColor(textLinkActiveForeground);
if (linkHover) {
collector.addRule(`.monaco-editor .parameter-hints-widget a:hover { color: ${linkHover}; }`);
}
const foreground = theme.getColor(editorHoverForeground);
if (foreground) {
collector.addRule(`.monaco-editor .parameter-hints-widget { color: ${foreground}; }`);
}
const codeBackground = theme.getColor(textCodeBlockBackground);
if (codeBackground) {
collector.addRule(`.monaco-editor .parameter-hints-widget code { background-color: ${codeBackground}; }`);
}
const parameterHighlightColor = theme.getColor(editorHoverWidgetHighlightForeground);
if (parameterHighlightColor) {
collector.addRule(`.monaco-editor .parameter-hints-widget .parameter.active { color: ${parameterHighlightColor}}`);
}
});
registerColor('editorHoverWidget.highlightForeground', { dark: listHighlightForeground, light: listHighlightForeground, hcDark: listHighlightForeground, hcLight: listHighlightForeground }, nls.localize('editorHoverWidgetHighlightForeground', 'Foreground color of the active item in the parameter hint.'));