Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Icons in problems view show black when not focused #173276

Merged
merged 2 commits into from
Feb 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
46 changes: 21 additions & 25 deletions src/vs/base/browser/ui/keybindingLabel/keybindingLabel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,22 @@ export interface KeybindingLabelOptions extends IKeybindingLabelStyles {
disableTitle?: boolean;
}

export type CSSValueString = string;

export interface IKeybindingLabelStyles {
keybindingLabelBackground?: CSSValueString;
keybindingLabelForeground?: CSSValueString;
keybindingLabelBorder?: CSSValueString;
keybindingLabelBottomBorder?: CSSValueString;
keybindingLabelShadow?: CSSValueString;
keybindingLabelBackground: string | undefined;
keybindingLabelForeground: string | undefined;
keybindingLabelBorder: string | undefined;
keybindingLabelBottomBorder: string | undefined;
keybindingLabelShadow: string | undefined;
}

export const unthemedKeybindingLabelOptions: KeybindingLabelOptions = {
keybindingLabelBackground: undefined,
keybindingLabelForeground: undefined,
keybindingLabelBorder: undefined,
keybindingLabelBottomBorder: undefined,
keybindingLabelShadow: undefined
};

export class KeybindingLabel {

private domNode: HTMLElement;
Expand All @@ -55,19 +61,9 @@ export class KeybindingLabel {
private matches: Matches | undefined;
private didEverRender: boolean;

private labelBackground: CSSValueString | undefined;
private labelBorder: CSSValueString | undefined;
private labelBottomBorder: CSSValueString | undefined;
private labelShadow: CSSValueString | undefined;

constructor(container: HTMLElement, private os: OperatingSystem, options?: KeybindingLabelOptions) {
this.options = options || Object.create(null);

this.labelBackground = this.options.keybindingLabelBackground;
this.labelBorder = this.options.keybindingLabelBorder;
this.labelBottomBorder = this.options.keybindingLabelBottomBorder;
this.labelShadow = this.options.keybindingLabelShadow;

const labelForeground = this.options.keybindingLabelForeground;

this.domNode = dom.append(container, $('.monaco-keybinding'));
Expand Down Expand Up @@ -158,17 +154,17 @@ export class KeybindingLabel {
const keyElement = $('span.monaco-keybinding-key' + extraClass, undefined, label);
this.keyElements.add(keyElement);

if (this.labelBackground) {
keyElement.style.backgroundColor = this.labelBackground;
if (this.options.keybindingLabelBackground) {
keyElement.style.backgroundColor = this.options.keybindingLabelBackground;
}
if (this.labelBorder) {
keyElement.style.borderColor = this.labelBorder;
if (this.options.keybindingLabelForeground) {
keyElement.style.borderColor = this.options.keybindingLabelForeground;
}
if (this.labelBottomBorder) {
keyElement.style.borderBottomColor = this.labelBottomBorder;
if (this.options.keybindingLabelBorder) {
keyElement.style.borderBottomColor = this.options.keybindingLabelBorder;
}
if (this.labelShadow) {
keyElement.style.boxShadow = `inset 0 -1px 0 ${this.labelShadow}`;
if (this.options.keybindingLabelShadow) {
keyElement.style.boxShadow = `inset 0 -1px 0 ${this.options.keybindingLabelShadow}`;
}

return keyElement;
Expand Down
7 changes: 4 additions & 3 deletions src/vs/base/browser/ui/progressbar/progressbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ const CSS_DISCRETE = 'discrete';
export interface IProgressBarOptions extends IProgressBarStyles {
}

export type CSSValueString = string;

export interface IProgressBarStyles {
progressBarBackground?: CSSValueString;
progressBarBackground: string | undefined;
}

export const unthemedProgressBarOptions: IProgressBarOptions = {
progressBarBackground: undefined
};

/**
* A progress bar with support for infinite or discrete progress.
Expand Down
6 changes: 4 additions & 2 deletions src/vs/base/parts/quickinput/test/browser/quickinput.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { raceTimeout } from 'vs/base/common/async';
import { QuickInputController } from 'vs/base/parts/quickinput/browser/quickInput';
import { IQuickPick, IQuickPickItem } from 'vs/base/parts/quickinput/common/quickInput';
import { unthemedCountStyles } from 'vs/base/browser/ui/countBadge/countBadge';
import { unthemedKeybindingLabelOptions } from 'vs/base/browser/ui/keybindingLabel/keybindingLabel';
import { unthemedProgressBarOptions } from 'vs/base/browser/ui/progressbar/progressbar';

// Sets up an `onShow` listener to allow us to wait until the quick pick is shown (useful when triggering an `accept()` right after launching a quick pick)
// kick this off before you launch the picker and then await the promise returned after you launch the picker.
Expand Down Expand Up @@ -60,9 +62,9 @@ suite('QuickInput', () => { // https://github.com/microsoft/vscode/issues/147543
countBadge: unthemedCountStyles,
inputBox: unthemedInboxStyles,
toggle: unthemedToggleStyles,
keybindingLabel: {},
keybindingLabel: unthemedKeybindingLabelOptions,
list: unthemedListStyles,
progressBar: {},
progressBar: unthemedProgressBarOptions,
widget: {
quickInputBackground: undefined,
quickInputForeground: undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { h } from 'vs/base/browser/dom';
import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
import { KeybindingLabel } from 'vs/base/browser/ui/keybindingLabel/keybindingLabel';
import { KeybindingLabel, unthemedKeybindingLabelOptions } from 'vs/base/browser/ui/keybindingLabel/keybindingLabel';
import { Action, IAction, Separator } from 'vs/base/common/actions';
import { RunOnceScheduler } from 'vs/base/common/async';
import { Codicon } from 'vs/base/common/codicons';
Expand Down Expand Up @@ -244,7 +244,7 @@ class StatusBarViewItem extends MenuEntryActionViewItem {
if (this.label) {
const div = h('div.keybinding').root;

const k = new KeybindingLabel(div, OS, { disableTitle: true });
const k = new KeybindingLabel(div, OS, { disableTitle: true, ...unthemedKeybindingLabelOptions });
k.set(kb);
this.label.textContent = this._action.label;
this.label.appendChild(div);
Expand Down