Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/vscode.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Aeschlimann <martinae@microsoft.com>2022-11-11 16:27:08 +0300
committerGitHub <noreply@github.com>2022-11-11 16:27:08 +0300
commite5bf5a7939d586e33d5ae822891040dfa906aeb5 (patch)
tree39e4382e35ef2785b2beec613bef9946b5cef62a
parent9984da1a19d2e2e43a4e40b2bf71076df67a45a9 (diff)
button: switch to theming by css variables (#165515)
* button: switch to themeing by css variables * make options mandatory, don't mixin default styles * merge fixes
-rw-r--r--src/vs/base/browser/ui/button/button.ts161
-rw-r--r--src/vs/base/browser/ui/dialog/dialog.ts2
-rw-r--r--src/vs/base/parts/quickinput/browser/quickInput.ts6
-rw-r--r--src/vs/code/electron-sandbox/issue/issueReporterMain.ts4
-rw-r--r--src/vs/platform/quickinput/browser/quickInput.ts11
-rw-r--r--src/vs/platform/theme/browser/defaultStyles.ts30
-rw-r--r--src/vs/platform/theme/common/styler.ts34
-rw-r--r--src/vs/workbench/browser/parts/notifications/notificationsViewer.ts10
-rw-r--r--src/vs/workbench/browser/parts/views/viewPane.ts6
-rw-r--r--src/vs/workbench/contrib/comments/browser/commentFormActions.ts7
-rw-r--r--src/vs/workbench/contrib/comments/browser/commentNode.ts4
-rw-r--r--src/vs/workbench/contrib/comments/browser/commentReply.ts2
-rw-r--r--src/vs/workbench/contrib/feedback/browser/feedback.ts6
-rw-r--r--src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts9
-rw-r--r--src/vs/workbench/contrib/preferences/browser/settingsTree.ts21
-rw-r--r--src/vs/workbench/contrib/preferences/browser/settingsWidgets.ts18
-rw-r--r--src/vs/workbench/contrib/remote/browser/tunnelView.ts6
-rw-r--r--src/vs/workbench/contrib/scm/browser/scmViewPane.ts15
-rw-r--r--src/vs/workbench/contrib/testing/browser/testingExplorerView.ts8
-rw-r--r--src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts5
-rw-r--r--src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts15
21 files changed, 159 insertions, 221 deletions
diff --git a/src/vs/base/browser/ui/button/button.ts b/src/vs/base/browser/ui/button/button.ts
index 6a4b19b76a2..5c750408f71 100644
--- a/src/vs/base/browser/ui/button/button.ts
+++ b/src/vs/base/browser/ui/button/button.ts
@@ -14,7 +14,6 @@ import { Color } from 'vs/base/common/color';
import { Emitter, Event as BaseEvent } from 'vs/base/common/event';
import { KeyCode } from 'vs/base/common/keyCodes';
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
-import { mixin } from 'vs/base/common/objects';
import { localize } from 'vs/nls';
import 'vs/css!./button';
@@ -24,22 +23,28 @@ export interface IButtonOptions extends IButtonStyles {
readonly secondary?: boolean;
}
+export type CSSValueString = string;
+
export interface IButtonStyles {
- buttonBackground?: Color;
- buttonHoverBackground?: Color;
- buttonForeground?: Color;
- buttonSeparator?: Color;
- buttonSecondaryBackground?: Color;
- buttonSecondaryHoverBackground?: Color;
- buttonSecondaryForeground?: Color;
- buttonBorder?: Color;
+ readonly buttonBackground?: CSSValueString;
+ readonly buttonHoverBackground?: CSSValueString;
+ readonly buttonForeground?: CSSValueString;
+ readonly buttonSeparator?: CSSValueString;
+ readonly buttonSecondaryBackground?: CSSValueString;
+ readonly buttonSecondaryHoverBackground?: CSSValueString;
+ readonly buttonSecondaryForeground?: CSSValueString;
+ readonly buttonBorder?: CSSValueString;
}
-const defaultOptions: IButtonStyles = {
- buttonBackground: Color.fromHex('#0E639C'),
- buttonHoverBackground: Color.fromHex('#006BB3'),
- buttonSeparator: Color.white,
- buttonForeground: Color.white
+export const defaultOptions: IButtonStyles = {
+ buttonBackground: '#0E639C',
+ buttonHoverBackground: '#006BB3',
+ buttonSeparator: Color.white.toString(),
+ buttonForeground: Color.white.toString(),
+ buttonBorder: undefined,
+ buttonSecondaryBackground: undefined,
+ buttonSecondaryForeground: undefined,
+ buttonSecondaryHoverBackground: undefined
};
export interface IButton extends IDisposable {
@@ -48,7 +53,6 @@ export interface IButton extends IDisposable {
label: string;
icon: CSSIcon;
enabled: boolean;
- style(styles: IButtonStyles): void;
focus(): void;
hasFocus(): boolean;
}
@@ -62,40 +66,31 @@ export class Button extends Disposable implements IButton {
protected _element: HTMLElement;
protected options: IButtonOptions;
- private buttonBackground: Color | undefined;
- private buttonHoverBackground: Color | undefined;
- private buttonForeground: Color | undefined;
- private buttonSecondaryBackground: Color | undefined;
- private buttonSecondaryHoverBackground: Color | undefined;
- private buttonSecondaryForeground: Color | undefined;
- private buttonBorder: Color | undefined;
-
private _onDidClick = this._register(new Emitter<Event>());
get onDidClick(): BaseEvent<Event> { return this._onDidClick.event; }
private focusTracker: IFocusTracker;
- constructor(container: HTMLElement, options?: IButtonOptions) {
+ constructor(container: HTMLElement, options: IButtonOptions) {
super();
- this.options = options || Object.create(null);
- mixin(this.options, defaultOptions, false);
-
- this.buttonForeground = this.options.buttonForeground;
- this.buttonBackground = this.options.buttonBackground;
- this.buttonHoverBackground = this.options.buttonHoverBackground;
-
- this.buttonSecondaryForeground = this.options.buttonSecondaryForeground;
- this.buttonSecondaryBackground = this.options.buttonSecondaryBackground;
- this.buttonSecondaryHoverBackground = this.options.buttonSecondaryHoverBackground;
-
- this.buttonBorder = this.options.buttonBorder;
+ this.options = options;
this._element = document.createElement('a');
this._element.classList.add('monaco-button');
this._element.tabIndex = 0;
this._element.setAttribute('role', 'button');
+ const background = options.secondary ? options.buttonSecondaryBackground : options.buttonBackground;
+ const foreground = options.secondary ? options.buttonSecondaryForeground : options.buttonForeground;
+ const border = options.buttonBorder;
+
+ this._element.style.color = foreground || '';
+ this._element.style.backgroundColor = background || '';
+ if (border) {
+ this._element.style.border = `1px solid ${border}`;
+ }
+
container.appendChild(this._element);
this._register(Gesture.addTarget(this._element));
@@ -129,65 +124,29 @@ export class Button extends Disposable implements IButton {
this._register(addDisposableListener(this._element, EventType.MOUSE_OVER, e => {
if (!this._element.classList.contains('disabled')) {
- this.setHoverBackground();
+ this.updateBackground(true);
}
}));
this._register(addDisposableListener(this._element, EventType.MOUSE_OUT, e => {
- this.applyStyles(); // restore standard styles
+ this.updateBackground(false); // restore standard styles
}));
// Also set hover background when button is focused for feedback
this.focusTracker = this._register(trackFocus(this._element));
- this._register(this.focusTracker.onDidFocus(() => { if (this.enabled) { this.setHoverBackground(); } }));
- this._register(this.focusTracker.onDidBlur(() => { if (this.enabled) { this.applyStyles(); } }));
-
- this.applyStyles();
+ this._register(this.focusTracker.onDidFocus(() => { if (this.enabled) { this.updateBackground(true); } }));
+ this._register(this.focusTracker.onDidBlur(() => { if (this.enabled) { this.updateBackground(false); } }));
}
- private setHoverBackground(): void {
- let hoverBackground;
+ private updateBackground(hover: boolean): void {
+ let background;
if (this.options.secondary) {
- hoverBackground = this.buttonSecondaryHoverBackground ? this.buttonSecondaryHoverBackground.toString() : null;
+ background = hover ? this.options.buttonSecondaryHoverBackground : this.options.buttonSecondaryBackground;
} else {
- hoverBackground = this.buttonHoverBackground ? this.buttonHoverBackground.toString() : null;
- }
- if (hoverBackground) {
- this._element.style.backgroundColor = hoverBackground;
+ background = hover ? this.options.buttonHoverBackground : this.options.buttonBackground;
}
- }
-
- style(styles: IButtonStyles): void {
- this.buttonForeground = styles.buttonForeground;
- this.buttonBackground = styles.buttonBackground;
- this.buttonHoverBackground = styles.buttonHoverBackground;
- this.buttonSecondaryForeground = styles.buttonSecondaryForeground;
- this.buttonSecondaryBackground = styles.buttonSecondaryBackground;
- this.buttonSecondaryHoverBackground = styles.buttonSecondaryHoverBackground;
- this.buttonBorder = styles.buttonBorder;
-
- this.applyStyles();
- }
-
- private applyStyles(): void {
- if (this._element) {
- let background, foreground;
- if (this.options.secondary) {
- foreground = this.buttonSecondaryForeground ? this.buttonSecondaryForeground.toString() : '';
- background = this.buttonSecondaryBackground ? this.buttonSecondaryBackground.toString() : '';
- } else {
- foreground = this.buttonForeground ? this.buttonForeground.toString() : '';
- background = this.buttonBackground ? this.buttonBackground.toString() : '';
- }
-
- const border = this.buttonBorder ? this.buttonBorder.toString() : '';
-
- this._element.style.color = foreground;
+ if (background) {
this._element.style.backgroundColor = background;
-
- this._element.style.borderWidth = border ? '1px' : '';
- this._element.style.borderStyle = border ? 'solid' : '';
- this._element.style.borderColor = border;
}
}
@@ -293,6 +252,21 @@ export class ButtonWithDropdown extends Disposable implements IButton {
this.separatorContainer.appendChild(this.separator);
this.element.appendChild(this.separatorContainer);
+ // Separator styles
+ const border = options.buttonBorder;
+ if (border) {
+ this.separatorContainer.style.borderTopWidth = '1px';
+ this.separatorContainer.style.borderTopStyle = 'solid';
+ this.separatorContainer.style.borderTopColor = border;
+
+ this.separatorContainer.style.borderBottomWidth = '1px';
+ this.separatorContainer.style.borderBottomStyle = 'solid';
+ this.separatorContainer.style.borderBottomColor = border;
+ }
+ this.separatorContainer.style.backgroundColor = options.buttonBackground?.toString() ?? '';
+ this.separator.style.backgroundColor = options.buttonSeparator?.toString() ?? '';
+
+
this.dropdownButton = this._register(new Button(this.element, { ...options, title: false, supportIcons: true }));
this.dropdownButton.element.title = localize("button dropdown more actions", 'More Actions...');
this.dropdownButton.element.setAttribute('aria-haspopup', 'true');
@@ -330,25 +304,6 @@ export class ButtonWithDropdown extends Disposable implements IButton {
return this.button.enabled;
}
- style(styles: IButtonStyles): void {
- this.button.style(styles);
- this.dropdownButton.style(styles);
-
- // Separator
- const border = styles.buttonBorder ? styles.buttonBorder.toString() : '';
-
- this.separatorContainer.style.borderTopWidth = border ? '1px' : '';
- this.separatorContainer.style.borderTopStyle = border ? 'solid' : '';
- this.separatorContainer.style.borderTopColor = border;
-
- this.separatorContainer.style.borderBottomWidth = border ? '1px' : '';
- this.separatorContainer.style.borderBottomStyle = border ? 'solid' : '';
- this.separatorContainer.style.borderBottomColor = border;
-
- this.separatorContainer.style.backgroundColor = styles.buttonBackground?.toString() ?? '';
- this.separator.style.backgroundColor = styles.buttonSeparator?.toString() ?? '';
- }
-
focus(): void {
this.button.focus();
}
@@ -363,7 +318,7 @@ export class ButtonWithDescription extends Button implements IButtonWithDescript
private _labelElement: HTMLElement;
private _descriptionElement: HTMLElement;
- constructor(container: HTMLElement, options?: IButtonOptions) {
+ constructor(container: HTMLElement, options: IButtonOptions) {
super(container, options);
this._element.classList.add('monaco-description-button');
@@ -412,13 +367,13 @@ export class ButtonBar extends Disposable {
return this._buttons;
}
- addButton(options?: IButtonOptions): IButton {
+ addButton(options: IButtonOptions): IButton {
const button = this._register(new Button(this.container, options));
this.pushButton(button);
return button;
}
- addButtonWithDescription(options?: IButtonOptions): IButtonWithDescription {
+ addButtonWithDescription(options: IButtonOptions): IButtonWithDescription {
const button = this._register(new ButtonWithDescription(this.container, options));
this.pushButton(button);
return button;
diff --git a/src/vs/base/browser/ui/dialog/dialog.ts b/src/vs/base/browser/ui/dialog/dialog.ts
index b8f106ef7af..f9263782278 100644
--- a/src/vs/base/browser/ui/dialog/dialog.ts
+++ b/src/vs/base/browser/ui/dialog/dialog.ts
@@ -427,8 +427,6 @@ export class Dialog extends Disposable {
this.element.style.backgroundColor = bgColor?.toString() ?? '';
this.element.style.border = border;
- this.buttonBar?.buttons.forEach(button => button.style(style));
-
this.checkbox?.style(style);
if (fgColor && bgColor) {
diff --git a/src/vs/base/parts/quickinput/browser/quickInput.ts b/src/vs/base/parts/quickinput/browser/quickInput.ts
index 6a97b88d5b5..88b60691ed2 100644
--- a/src/vs/base/parts/quickinput/browser/quickInput.ts
+++ b/src/vs/base/parts/quickinput/browser/quickInput.ts
@@ -1295,14 +1295,14 @@ export class QuickInputController extends Disposable {
const count = new CountBadge(countContainer, { countFormat: localize({ key: 'quickInput.countSelected', comment: ['This tells the user how many items are selected in a list of items to select from. The items can be anything.'] }, "{0} Selected") });
const okContainer = dom.append(headerContainer, $('.quick-input-action'));
- const ok = new Button(okContainer);
+ const ok = new Button(okContainer, this.styles.button);
ok.label = localize('ok', "OK");
this._register(ok.onDidClick(e => {
this.onDidAcceptEmitter.fire();
}));
const customButtonContainer = dom.append(headerContainer, $('.quick-input-action'));
- const customButton = new Button(customButtonContainer);
+ const customButton = new Button(customButtonContainer, this.styles.button);
customButton.label = localize('custom', "Custom");
this._register(customButton.onDidClick(e => {
this.onDidCustomEmitter.fire();
@@ -1825,8 +1825,6 @@ export class QuickInputController extends Disposable {
this.ui.container.style.boxShadow = widgetShadow ? `0 0 8px 2px ${widgetShadow}` : '';
this.ui.inputBox.style(this.styles.inputBox);
this.ui.count.style(this.styles.countBadge);
- this.ui.ok.style(this.styles.button);
- this.ui.customButton.style(this.styles.button);
this.ui.list.style(this.styles.list);
const content: string[] = [];
diff --git a/src/vs/code/electron-sandbox/issue/issueReporterMain.ts b/src/vs/code/electron-sandbox/issue/issueReporterMain.ts
index 33e66bedc76..442e4c4d2f7 100644
--- a/src/vs/code/electron-sandbox/issue/issueReporterMain.ts
+++ b/src/vs/code/electron-sandbox/issue/issueReporterMain.ts
@@ -7,7 +7,7 @@ import 'vs/css!./media/issueReporter';
import 'vs/base/browser/ui/codicons/codiconStyles'; // make sure codicon css is loaded
import { localize } from 'vs/nls';
import { $, reset, safeInnerHtml, windowOpenNoOpener } from 'vs/base/browser/dom';
-import { Button } from 'vs/base/browser/ui/button/button';
+import { Button, defaultOptions } from 'vs/base/browser/ui/button/button';
import { renderIcon } from 'vs/base/browser/ui/iconLabel/iconLabels';
import { Delayer } from 'vs/base/common/async';
import { Codicon } from 'vs/base/common/codicons';
@@ -88,7 +88,7 @@ export class IssueReporter extends Disposable {
const issueReporterElement = this.getElementById('issue-reporter');
if (issueReporterElement) {
- this.previewButton = new Button(issueReporterElement);
+ this.previewButton = new Button(issueReporterElement, defaultOptions);
this.updatePreviewButtonState();
}
diff --git a/src/vs/platform/quickinput/browser/quickInput.ts b/src/vs/platform/quickinput/browser/quickInput.ts
index d0ec435f2ae..6210a38dad6 100644
--- a/src/vs/platform/quickinput/browser/quickInput.ts
+++ b/src/vs/platform/quickinput/browser/quickInput.ts
@@ -16,8 +16,8 @@ import { IWorkbenchListOptions, WorkbenchList } from 'vs/platform/list/browser/l
import { QuickAccessController } from 'vs/platform/quickinput/browser/quickAccess';
import { IQuickAccessController } from 'vs/platform/quickinput/common/quickAccess';
import { IInputBox, IInputOptions, IKeyMods, IPickOptions, IQuickInputButton, IQuickInputService, IQuickNavigateConfiguration, IQuickPick, IQuickPickItem, QuickPickInput } from 'vs/platform/quickinput/common/quickInput';
-import { getProgressBarStyles } from 'vs/platform/theme/browser/defaultStyles';
-import { activeContrastBorder, badgeBackground, badgeForeground, buttonBackground, buttonForeground, buttonHoverBackground, contrastBorder, inputBackground, inputBorder, inputForeground, inputValidationErrorBackground, inputValidationErrorBorder, inputValidationErrorForeground, inputValidationInfoBackground, inputValidationInfoBorder, inputValidationInfoForeground, inputValidationWarningBackground, inputValidationWarningBorder, inputValidationWarningForeground, keybindingLabelBackground, keybindingLabelBorder, keybindingLabelBottomBorder, keybindingLabelForeground, pickerGroupBorder, pickerGroupForeground, quickInputBackground, quickInputForeground, quickInputListFocusBackground, quickInputListFocusForeground, quickInputListFocusIconForeground, quickInputTitleBackground, widgetShadow } from 'vs/platform/theme/common/colorRegistry';
+import { defaultButtonStyles, getProgressBarStyles } from 'vs/platform/theme/browser/defaultStyles';
+import { activeContrastBorder, badgeBackground, badgeForeground, contrastBorder, inputBackground, inputBorder, inputForeground, inputValidationErrorBackground, inputValidationErrorBorder, inputValidationErrorForeground, inputValidationInfoBackground, inputValidationInfoBorder, inputValidationInfoForeground, inputValidationWarningBackground, inputValidationWarningBorder, inputValidationWarningForeground, keybindingLabelBackground, keybindingLabelBorder, keybindingLabelBottomBorder, keybindingLabelForeground, pickerGroupBorder, pickerGroupForeground, quickInputBackground, quickInputForeground, quickInputListFocusBackground, quickInputListFocusForeground, quickInputListFocusIconForeground, quickInputTitleBackground, widgetShadow } from 'vs/platform/theme/common/colorRegistry';
import { computeStyles } from 'vs/platform/theme/common/styler';
import { IThemeService, Themable } from 'vs/platform/theme/common/themeService';
@@ -213,12 +213,7 @@ export class QuickInputService extends Themable implements IQuickInputService {
badgeForeground,
badgeBorder: contrastBorder
}),
- button: computeStyles(this.theme, {
- buttonForeground,
- buttonBackground,
- buttonHoverBackground,
- buttonBorder: contrastBorder
- }),
+ button: defaultButtonStyles,
progressBar: getProgressBarStyles(), // default uses progressBarBackground
keybindingLabel: computeStyles(this.theme, {
keybindingLabelBackground,
diff --git a/src/vs/platform/theme/browser/defaultStyles.ts b/src/vs/platform/theme/browser/defaultStyles.ts
index cccca684835..5220a7c0263 100644
--- a/src/vs/platform/theme/browser/defaultStyles.ts
+++ b/src/vs/platform/theme/browser/defaultStyles.ts
@@ -2,9 +2,10 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
+import { IButtonStyles } from 'vs/base/browser/ui/button/button';
import { IKeybindingLabelStyles } from 'vs/base/browser/ui/keybindingLabel/keybindingLabel';
+import { ColorIdentifier, keybindingLabelBackground, keybindingLabelBorder, keybindingLabelBottomBorder, keybindingLabelForeground, asCssValue, widgetShadow, buttonForeground, buttonSeparator, buttonBackground, buttonHoverBackground, buttonSecondaryForeground, buttonSecondaryBackground, buttonSecondaryHoverBackground, buttonBorder, progressBarBackground } from 'vs/platform/theme/common/colorRegistry';
import { IProgressBarStyles } from 'vs/base/browser/ui/progressbar/progressbar';
-import { ColorIdentifier, keybindingLabelBackground, keybindingLabelBorder, keybindingLabelBottomBorder, keybindingLabelForeground, asCssValue, widgetShadow, progressBarBackground } from 'vs/platform/theme/common/colorRegistry';
import { IStyleOverrides } from 'vs/platform/theme/common/styler';
@@ -26,6 +27,33 @@ export function getKeybindingLabelStyles(style?: IKeybindingLabelStyleOverrides)
};
}
+export interface IButtonStyleOverrides extends IStyleOverrides {
+ readonly buttonForeground?: ColorIdentifier;
+ readonly buttonSeparator?: ColorIdentifier;
+ readonly buttonBackground?: ColorIdentifier;
+ readonly buttonHoverBackground?: ColorIdentifier;
+ readonly buttonSecondaryForeground?: ColorIdentifier;
+ readonly buttonSecondaryBackground?: ColorIdentifier;
+ readonly buttonSecondaryHoverBackground?: ColorIdentifier;
+ readonly buttonBorder?: ColorIdentifier;
+}
+
+
+export const defaultButtonStyles: IButtonStyles = getButtonStyles({});
+
+export function getButtonStyles(style: IButtonStyleOverrides): IButtonStyles {
+ return {
+ buttonForeground: asCssValue(style.buttonForeground || buttonForeground),
+ buttonSeparator: asCssValue(style.buttonSeparator || buttonSeparator),
+ buttonBackground: asCssValue(style.buttonBackground || buttonBackground),
+ buttonHoverBackground: asCssValue(style.buttonHoverBackground || buttonHoverBackground),
+ buttonSecondaryForeground: asCssValue(style.buttonSecondaryForeground || buttonSecondaryForeground),
+ buttonSecondaryBackground: asCssValue(style.buttonSecondaryBackground || buttonSecondaryBackground),
+ buttonSecondaryHoverBackground: asCssValue(style.buttonSecondaryHoverBackground || buttonSecondaryHoverBackground),
+ buttonBorder: asCssValue(style.buttonBorder || buttonBorder),
+ };
+}
+
export interface IProgressBarStyleOverrides extends IStyleOverrides {
progressBarBackground?: ColorIdentifier;
}
diff --git a/src/vs/platform/theme/common/styler.ts b/src/vs/platform/theme/common/styler.ts
index 7587af95a80..d1c8fc7594c 100644
--- a/src/vs/platform/theme/common/styler.ts
+++ b/src/vs/platform/theme/common/styler.ts
@@ -238,29 +238,6 @@ export const defaultListStyles: IColorMapping = {
inputValidationErrorBorder,
};
-export interface IButtonStyleOverrides extends IStyleOverrides {
- buttonForeground?: ColorIdentifier;
- buttonSeparator?: ColorIdentifier;
- buttonBackground?: ColorIdentifier;
- buttonHoverBackground?: ColorIdentifier;
- buttonSecondaryForeground?: ColorIdentifier;
- buttonSecondaryBackground?: ColorIdentifier;
- buttonSecondaryHoverBackground?: ColorIdentifier;
- buttonBorder?: ColorIdentifier;
-}
-
-export function attachButtonStyler(widget: IThemable, themeService: IThemeService, style?: IButtonStyleOverrides): IDisposable {
- return attachStyler(themeService, {
- buttonForeground: style?.buttonForeground || buttonForeground,
- buttonSeparator: style?.buttonSeparator || buttonSeparator,
- buttonBackground: style?.buttonBackground || buttonBackground,
- buttonHoverBackground: style?.buttonHoverBackground || buttonHoverBackground,
- buttonSecondaryForeground: style?.buttonSecondaryForeground || buttonSecondaryForeground,
- buttonSecondaryBackground: style?.buttonSecondaryBackground || buttonSecondaryBackground,
- buttonSecondaryHoverBackground: style?.buttonSecondaryHoverBackground || buttonSecondaryHoverBackground,
- buttonBorder: style?.buttonBorder || buttonBorder,
- } as IButtonStyleOverrides, widget);
-}
export function attachStylerCallback(themeService: IThemeService, colors: { [name: string]: ColorIdentifier }, callback: styleFn): IDisposable {
return attachStyler(themeService, colors, callback);
@@ -316,6 +293,17 @@ export function attachMenuStyler(widget: IThemable, themeService: IThemeService,
return attachStyler(themeService, { ...defaultMenuStyles, ...style }, widget);
}
+interface IButtonStyleOverrides extends IStyleOverrides {
+ buttonForeground?: ColorIdentifier;
+ buttonSeparator?: ColorIdentifier;
+ buttonBackground?: ColorIdentifier;
+ buttonHoverBackground?: ColorIdentifier;
+ buttonSecondaryForeground?: ColorIdentifier;
+ buttonSecondaryBackground?: ColorIdentifier;
+ buttonSecondaryHoverBackground?: ColorIdentifier;
+ buttonBorder?: ColorIdentifier;
+}
+
export interface IDialogStyleOverrides extends IButtonStyleOverrides {
dialogForeground?: ColorIdentifier;
dialogBackground?: ColorIdentifier;
diff --git a/src/vs/workbench/browser/parts/notifications/notificationsViewer.ts b/src/vs/workbench/browser/parts/notifications/notificationsViewer.ts
index db831090a83..05dbe36b621 100644
--- a/src/vs/workbench/browser/parts/notifications/notificationsViewer.ts
+++ b/src/vs/workbench/browser/parts/notifications/notificationsViewer.ts
@@ -9,8 +9,6 @@ import { IOpenerService } from 'vs/platform/opener/common/opener';
import { URI } from 'vs/base/common/uri';
import { localize } from 'vs/nls';
import { ButtonBar, IButtonOptions } from 'vs/base/browser/ui/button/button';
-import { attachButtonStyler } from 'vs/platform/theme/common/styler';
-import { IThemeService } from 'vs/platform/theme/common/themeService';
import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
import { ActionRunner, IAction, IActionRunner } from 'vs/base/common/actions';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
@@ -27,7 +25,7 @@ import { DropdownMenuActionViewItem } from 'vs/base/browser/ui/dropdown/dropdown
import { DomEmitter } from 'vs/base/browser/event';
import { Gesture, EventType as GestureEventType } from 'vs/base/browser/touch';
import { Event } from 'vs/base/common/event';
-import { getProgressBarStyles } from 'vs/platform/theme/browser/defaultStyles';
+import { defaultButtonStyles, getProgressBarStyles } from 'vs/platform/theme/browser/defaultStyles';
export class NotificationsListDelegate implements IListVirtualDelegate<INotificationViewItem> {
@@ -293,7 +291,6 @@ export class NotificationTemplateRenderer extends Disposable {
private actionRunner: IActionRunner,
@IOpenerService private readonly openerService: IOpenerService,
@IInstantiationService private readonly instantiationService: IInstantiationService,
- @IThemeService private readonly themeService: IThemeService,
@IKeybindingService private readonly keybindingService: IKeybindingService,
@IContextMenuService private readonly contextMenuService: IContextMenuService,
) {
@@ -472,7 +469,8 @@ export class NotificationTemplateRenderer extends Disposable {
const options: IButtonOptions = {
title: true, // assign titles to buttons in case they overflow
- secondary: i > 0
+ secondary: i > 0,
+ ...defaultButtonStyles
};
const dropdownActions = action instanceof ChoiceAction ? action.menu : undefined;
@@ -495,8 +493,6 @@ export class NotificationTemplateRenderer extends Disposable {
actionRunner.run(action);
}));
-
- this.inputDisposables.add(attachButtonStyler(button, this.themeService));
}
}
}
diff --git a/src/vs/workbench/browser/parts/views/viewPane.ts b/src/vs/workbench/browser/parts/views/viewPane.ts
index 456b0443e48..e61f0fdbb46 100644
--- a/src/vs/workbench/browser/parts/views/viewPane.ts
+++ b/src/vs/workbench/browser/parts/views/viewPane.ts
@@ -7,7 +7,6 @@ import 'vs/css!./media/paneviewlet';
import * as nls from 'vs/nls';
import { Event, Emitter } from 'vs/base/common/event';
import { foreground } from 'vs/platform/theme/common/colorRegistry';
-import { attachButtonStyler } from 'vs/platform/theme/common/styler';
import { PANEL_BACKGROUND, SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme';
import { after, append, $, trackFocus, EventType, addDisposableListener, createCSSRule, asCSSUrl, Dimension, reset } from 'vs/base/browser/dom';
import { IDisposable, Disposable, DisposableStore } from 'vs/base/common/lifecycle';
@@ -45,7 +44,7 @@ import { WorkbenchToolBar } from 'vs/platform/actions/browser/toolbar';
import { FilterWidget, IFilterWidgetOptions } from 'vs/workbench/browser/parts/views/viewFilter';
import { BaseActionViewItem } from 'vs/base/browser/ui/actionbar/actionViewItems';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
-import { getProgressBarStyles } from 'vs/platform/theme/browser/defaultStyles';
+import { defaultButtonStyles, getProgressBarStyles } from 'vs/platform/theme/browser/defaultStyles';
export interface IViewPaneOptions extends IPaneOptions {
id: string;
@@ -588,14 +587,13 @@ export abstract class ViewPane extends Pane implements IView {
if (linkedText.nodes.length === 1 && typeof linkedText.nodes[0] !== 'string') {
const node = linkedText.nodes[0];
const buttonContainer = append(this.viewWelcomeContainer, $('.button-container'));
- const button = new Button(buttonContainer, { title: node.title, supportIcons: true });
+ const button = new Button(buttonContainer, { title: node.title, supportIcons: true, ...defaultButtonStyles });
button.label = node.label;
button.onDidClick(_ => {
this.telemetryService.publicLog2<{ viewId: string; uri: string }, WelcomeActionClassification>('views.welcomeAction', { viewId: this.id, uri: node.href });
this.openerService.open(node.href, { allowCommands: true });
}, null, disposables);
disposables.add(button);
- disposables.add(attachButtonStyler(button, this.themeService));
if (precondition) {
const updateEnablement = () => button.enabled = this.contextKeyService.contextMatchesRules(precondition);
diff --git a/src/vs/workbench/contrib/comments/browser/commentFormActions.ts b/src/vs/workbench/contrib/comments/browser/commentFormActions.ts
index 2883aa76346..8e5bed5afac 100644
--- a/src/vs/workbench/contrib/comments/browser/commentFormActions.ts
+++ b/src/vs/workbench/contrib/comments/browser/commentFormActions.ts
@@ -7,8 +7,7 @@ import { Button } from 'vs/base/browser/ui/button/button';
import { IAction } from 'vs/base/common/actions';
import { DisposableStore, IDisposable } from 'vs/base/common/lifecycle';
import { IMenu } from 'vs/platform/actions/common/actions';
-import { attachButtonStyler } from 'vs/platform/theme/common/styler';
-import { IThemeService } from 'vs/platform/theme/common/themeService';
+import { defaultButtonStyles } from 'vs/platform/theme/browser/defaultStyles';
export class CommentFormActions implements IDisposable {
private _buttonElements: HTMLElement[] = [];
@@ -18,7 +17,6 @@ export class CommentFormActions implements IDisposable {
constructor(
private container: HTMLElement,
private actionHandler: (action: IAction) => void,
- private themeService: IThemeService
) { }
setActions(menu: IMenu) {
@@ -33,12 +31,11 @@ export class CommentFormActions implements IDisposable {
this._actions = actions;
for (const action of actions) {
- const button = new Button(this.container, { secondary: !isPrimary });
+ const button = new Button(this.container, { secondary: !isPrimary, ...defaultButtonStyles });
isPrimary = false;
this._buttonElements.push(button.element);
this._toDispose.add(button);
- this._toDispose.add(attachButtonStyler(button, this.themeService));
this._toDispose.add(button.onDidClick(() => this.actionHandler(action)));
button.enabled = action.enabled;
diff --git a/src/vs/workbench/contrib/comments/browser/commentNode.ts b/src/vs/workbench/contrib/comments/browser/commentNode.ts
index 540457c3641..e55ce947175 100644
--- a/src/vs/workbench/contrib/comments/browser/commentNode.ts
+++ b/src/vs/workbench/contrib/comments/browser/commentNode.ts
@@ -15,7 +15,6 @@ import { IModelService } from 'vs/editor/common/services/model';
import { ILanguageService } from 'vs/editor/common/languages/language';
import { MarkdownRenderer } from 'vs/editor/contrib/markdownRenderer/browser/markdownRenderer';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
-import { IThemeService } from 'vs/platform/theme/common/themeService';
import { ICommentService } from 'vs/workbench/contrib/comments/browser/commentService';
import { SimpleCommentEditor } from 'vs/workbench/contrib/comments/browser/simpleCommentEditor';
import { Selection } from 'vs/editor/common/core/selection';
@@ -84,7 +83,6 @@ export class CommentNode<T extends IRange | ICellRange> extends Disposable {
private resource: URI,
private parentThread: ICommentThreadWidget,
private markdownRenderer: MarkdownRenderer,
- @IThemeService private themeService: IThemeService,
@IInstantiationService private instantiationService: IInstantiationService,
@ICommentService private commentService: ICommentService,
@IModelService private modelService: IModelService,
@@ -492,7 +490,7 @@ export class CommentNode<T extends IRange | ICellRange> extends Disposable {
});
this.removeCommentEditor();
- }, this.themeService);
+ });
this._register(this._commentFormActions);
this._commentFormActions.setActions(menu);
diff --git a/src/vs/workbench/contrib/comments/browser/commentReply.ts b/src/vs/workbench/contrib/comments/browser/commentReply.ts
index 1f05642c792..3efe67224b9 100644
--- a/src/vs/workbench/contrib/comments/browser/commentReply.ts
+++ b/src/vs/workbench/contrib/comments/browser/commentReply.ts
@@ -259,7 +259,7 @@ export class CommentReply<T extends IRange | ICellRange> extends Disposable {
});
this.hideReplyArea();
- }, this.themeService);
+ });
this._register(this._commentFormActions);
this._commentFormActions.setActions(menu);
diff --git a/src/vs/workbench/contrib/feedback/browser/feedback.ts b/src/vs/workbench/contrib/feedback/browser/feedback.ts
index 77be54e32c4..dad00b3f8cc 100644
--- a/src/vs/workbench/contrib/feedback/browser/feedback.ts
+++ b/src/vs/workbench/contrib/feedback/browser/feedback.ts
@@ -10,7 +10,7 @@ import { IContextViewService } from 'vs/platform/contextview/browser/contextView
import { ICommandService } from 'vs/platform/commands/common/commands';
import { IIntegrityService } from 'vs/workbench/services/integrity/common/integrity';
import { IThemeService, registerThemingParticipant, IColorTheme, ICssStyleCollector } from 'vs/platform/theme/common/themeService';
-import { attachButtonStyler, attachStylerCallback } from 'vs/platform/theme/common/styler';
+import { attachStylerCallback } from 'vs/platform/theme/common/styler';
import { editorWidgetBackground, editorWidgetForeground, widgetShadow, inputBorder, inputForeground, inputBackground, inputActiveOptionBorder, editorBackground, textLinkForeground, contrastBorder } from 'vs/platform/theme/common/colorRegistry';
import { append, $, addDisposableListener, EventType, EventHelper, prepend } from 'vs/base/browser/dom';
import { IAnchor } from 'vs/base/browser/ui/contextview/contextview';
@@ -25,6 +25,7 @@ import { KeyCode } from 'vs/base/common/keyCodes';
import { Codicon } from 'vs/base/common/codicons';
import { Emitter } from 'vs/base/common/event';
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
+import { defaultButtonStyles } from 'vs/platform/theme/browser/defaultStyles';
export interface IFeedback {
feedback: string;
@@ -280,13 +281,12 @@ export class FeedbackWidget extends Disposable {
hideButtonLabel.textContent = localize('showFeedback', "Show Feedback Icon in Status Bar");
// Button: Send Feedback
- this.sendButton = new Button(buttonsContainer);
+ this.sendButton = new Button(buttonsContainer, defaultButtonStyles);
this.sendButton.enabled = false;
this.sendButton.label = localize('tweet', "Tweet");
prepend(this.sendButton.element, $(`span${Codicon.twitter.cssSelector}`));
this.sendButton.element.classList.add('send');
this.sendButton.element.title = localize('tweetFeedback', "Tweet Feedback");
- disposables.add(attachButtonStyler(this.sendButton, this.themeService));
this.sendButton.onDidClick(() => this.onSubmit());
diff --git a/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts b/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts
index 12760e0c0eb..164b51b5dfc 100644
--- a/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts
+++ b/src/vs/workbench/contrib/preferences/browser/settingsEditor2.ts
@@ -32,7 +32,7 @@ import { ILogService } from 'vs/platform/log/common/log';
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { badgeBackground, badgeForeground, contrastBorder, editorForeground } from 'vs/platform/theme/common/colorRegistry';
-import { attachButtonStyler, attachStylerCallback } from 'vs/platform/theme/common/styler';
+import { attachStylerCallback } from 'vs/platform/theme/common/styler';
import { IThemeService, ThemeIcon } from 'vs/platform/theme/common/themeService';
import { IUserDataSyncEnablementService, IUserDataSyncService, SyncStatus } from 'vs/platform/userDataSync/common/userDataSync';
import { EditorPane } from 'vs/workbench/browser/parts/editor/editorPane';
@@ -63,6 +63,7 @@ import { IExtensionManagementService } from 'vs/platform/extensionManagement/com
import { ISettingOverrideClickEvent } from 'vs/workbench/contrib/preferences/browser/settingsEditorSettingIndicators';
import { ConfigurationScope, Extensions, IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry';
import { Registry } from 'vs/platform/registry/common/platform';
+import { defaultButtonStyles } from 'vs/platform/theme/browser/defaultStyles';
export const enum SettingsFocusContext {
Search,
@@ -1703,15 +1704,13 @@ class SyncControls extends Disposable {
container: HTMLElement,
@ICommandService private readonly commandService: ICommandService,
@IUserDataSyncService private readonly userDataSyncService: IUserDataSyncService,
- @IUserDataSyncEnablementService private readonly userDataSyncEnablementService: IUserDataSyncEnablementService,
- @IThemeService themeService: IThemeService,
+ @IUserDataSyncEnablementService private readonly userDataSyncEnablementService: IUserDataSyncEnablementService
) {
super();
const headerRightControlsContainer = DOM.append(container, $('.settings-right-controls'));
const turnOnSyncButtonContainer = DOM.append(headerRightControlsContainer, $('.turn-on-sync'));
- this.turnOnSyncButton = this._register(new Button(turnOnSyncButtonContainer, { title: true }));
- this._register(attachButtonStyler(this.turnOnSyncButton, themeService));
+ this.turnOnSyncButton = this._register(new Button(turnOnSyncButtonContainer, { title: true, ...defaultButtonStyles }));
this.lastSyncedLabel = DOM.append(headerRightControlsContainer, $('.last-synced-label'));
DOM.hide(this.lastSyncedLabel);
diff --git a/src/vs/workbench/contrib/preferences/browser/settingsTree.ts b/src/vs/workbench/contrib/preferences/browser/settingsTree.ts
index cc65c8b5d73..aca340635d4 100644
--- a/src/vs/workbench/contrib/preferences/browser/settingsTree.ts
+++ b/src/vs/workbench/contrib/preferences/browser/settingsTree.ts
@@ -36,7 +36,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IOpenerService } from 'vs/platform/opener/common/opener';
import { editorBackground, foreground } from 'vs/platform/theme/common/colorRegistry';
-import { attachButtonStyler, attachInputBoxStyler, attachSelectBoxStyler, attachStyler } from 'vs/platform/theme/common/styler';
+import { attachInputBoxStyler, attachSelectBoxStyler, attachStyler } from 'vs/platform/theme/common/styler';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { getIgnoredSettings } from 'vs/platform/userDataSync/common/settingsMerge';
import { ITOCEntry } from 'vs/workbench/contrib/preferences/browser/settingsLayout';
@@ -64,6 +64,7 @@ import { getIndicatorsLabelAriaLabel, ISettingOverrideClickEvent, SettingsTreeIn
import { ILanguageService } from 'vs/editor/common/languages/language';
import { ConfigurationScope } from 'vs/platform/configuration/common/configurationRegistry';
import { IUserDataProfilesService } from 'vs/platform/userDataProfile/common/userDataProfile';
+import { defaultButtonStyles, getButtonStyles } from 'vs/platform/theme/browser/defaultStyles';
const $ = DOM.$;
@@ -1006,7 +1007,6 @@ export class SettingNewExtensionsRenderer implements ITreeRenderer<SettingsTreeN
templateId = SETTINGS_NEW_EXTENSIONS_TEMPLATE_ID;
constructor(
- @IThemeService private readonly _themeService: IThemeService,
@ICommandService private readonly _commandService: ICommandService,
) {
}
@@ -1016,7 +1016,7 @@ export class SettingNewExtensionsRenderer implements ITreeRenderer<SettingsTreeN
container.classList.add('setting-item-new-extensions');
- const button = new Button(container, { title: true, buttonBackground: undefined, buttonHoverBackground: undefined });
+ const button = new Button(container, { title: true, ...defaultButtonStyles });
toDispose.add(button);
toDispose.add(button.onDidClick(() => {
if (template.context) {
@@ -1025,7 +1025,6 @@ export class SettingNewExtensionsRenderer implements ITreeRenderer<SettingsTreeN
}));
button.label = localize('newExtensionsButtonLabel', "Show matching extensions");
button.element.classList.add('settings-new-extensions-button');
- toDispose.add(attachButtonStyler(button, this._themeService));
const template: ISettingNewExtensionsTemplate = {
button,
@@ -1052,18 +1051,18 @@ export class SettingComplexRenderer extends AbstractSettingRenderer implements I
renderTemplate(container: HTMLElement): ISettingComplexItemTemplate {
const common = this.renderCommonTemplate(null, container, 'complex');
- const openSettingsButton = new Button(common.controlElement, { title: true, buttonBackground: undefined, buttonHoverBackground: undefined });
+ const openSettingsButton = new Button(common.controlElement, {
+ title: true, ...getButtonStyles({
+ buttonBackground: Color.transparent.toString(),
+ buttonHoverBackground: Color.transparent.toString(),
+ buttonForeground: 'foreground'
+ })
+ });
common.toDispose.add(openSettingsButton);
openSettingsButton.element.classList.add('edit-in-settings-button');
openSettingsButton.element.classList.add(AbstractSettingRenderer.CONTROL_CLASS);
- common.toDispose.add(attachButtonStyler(openSettingsButton, this._themeService, {
- buttonBackground: Color.transparent.toString(),
- buttonHoverBackground: Color.transparent.toString(),
- buttonForeground: 'foreground'
- }));
-
const validationErrorMessageElement = $('.setting-item-validation-message');
common.containerElement.appendChild(validationErrorMessageElement);
diff --git a/src/vs/workbench/contrib/preferences/browser/settingsWidgets.ts b/src/vs/workbench/contrib/preferences/browser/settingsWidgets.ts
index 48c4089c26f..08371f9de22 100644
--- a/src/vs/workbench/contrib/preferences/browser/settingsWidgets.ts
+++ b/src/vs/workbench/contrib/preferences/browser/settingsWidgets.ts
@@ -22,10 +22,11 @@ import { isDefined, isUndefinedOrNull } from 'vs/base/common/types';
import 'vs/css!./media/settingsWidgets';
import { localize } from 'vs/nls';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
-import { attachButtonStyler, attachInputBoxStyler, attachSelectBoxStyler } from 'vs/platform/theme/common/styler';
+import { attachInputBoxStyler, attachSelectBoxStyler } from 'vs/platform/theme/common/styler';
import { IThemeService, ThemeIcon } from 'vs/platform/theme/common/themeService';
import { settingsDiscardIcon, settingsEditIcon, settingsRemoveIcon } from 'vs/workbench/contrib/preferences/browser/preferencesIcons';
import { settingsSelectBackground, settingsSelectBorder, settingsSelectForeground, settingsSelectListBorder, settingsTextInputBackground, settingsTextInputBorder, settingsTextInputForeground } from 'vs/workbench/contrib/preferences/common/settingsEditorColorRegistry';
+import { defaultButtonStyles } from 'vs/platform/theme/browser/defaultStyles';
const $ = DOM.$;
@@ -295,10 +296,9 @@ export abstract class AbstractListSettingWidget<TDataItem extends object> extend
private renderAddButton(): HTMLElement {
const rowElement = $('.setting-list-new-row');
- const startAddButton = this._register(new Button(rowElement));
+ const startAddButton = this._register(new Button(rowElement, defaultButtonStyles));
startAddButton.label = this.getLocalizedStrings().addButtonLabel;
startAddButton.element.classList.add('setting-list-addButton');
- this._register(attachButtonStyler(startAddButton, this.themeService));
this._register(startAddButton.onDidClick(() => {
this.model.setEditKey('create');
@@ -632,11 +632,10 @@ export class ListSettingWidget extends AbstractListSettingWidget<IListDataItem>
valueInput.element.classList.add('no-sibling');
}
- const okButton = this._register(new Button(rowElement));
+ const okButton = this._register(new Button(rowElement, defaultButtonStyles));
okButton.label = localize('okButton', "OK");
okButton.element.classList.add('setting-list-ok-button');
- this.listDisposables.add(attachButtonStyler(okButton, this.themeService));
this.listDisposables.add(okButton.onDidClick(() => {
if (item.value.type === 'string') {
this.handleItemChange(item, updatedInputBoxItem(), idx);
@@ -645,11 +644,10 @@ export class ListSettingWidget extends AbstractListSettingWidget<IListDataItem>
}
}));
- const cancelButton = this._register(new Button(rowElement, { secondary: true }));
+ const cancelButton = this._register(new Button(rowElement, { secondary: true, ...defaultButtonStyles }));
cancelButton.label = localize('cancelButton', "Cancel");
cancelButton.element.classList.add('setting-list-cancel-button');
- this.listDisposables.add(attachButtonStyler(cancelButton, this.themeService));
this.listDisposables.add(cancelButton.onDidClick(() => this.cancelEdit()));
this.listDisposables.add(
@@ -970,19 +968,17 @@ export class ObjectSettingDropdownWidget extends AbstractListSettingWidget<IObje
rowElement.append(keyElement, valueContainer);
- const okButton = this._register(new Button(rowElement));
+ const okButton = this._register(new Button(rowElement, defaultButtonStyles));
okButton.enabled = changedItem.key.data !== '';
okButton.label = localize('okButton', "OK");
okButton.element.classList.add('setting-list-ok-button');
- this.listDisposables.add(attachButtonStyler(okButton, this.themeService));
this.listDisposables.add(okButton.onDidClick(() => this.handleItemChange(item, changedItem, idx)));
- const cancelButton = this._register(new Button(rowElement, { secondary: true }));
+ const cancelButton = this._register(new Button(rowElement, { secondary: true, ...defaultButtonStyles }));
cancelButton.label = localize('cancelButton', "Cancel");
cancelButton.element.classList.add('setting-list-cancel-button');
- this.listDisposables.add(attachButtonStyler(cancelButton, this.themeService));
this.listDisposables.add(cancelButton.onDidClick(() => this.cancelEdit()));
this.listDisposables.add(
diff --git a/src/vs/workbench/contrib/remote/browser/tunnelView.ts b/src/vs/workbench/contrib/remote/browser/tunnelView.ts
index e01d95ec63a..b06f48dd8a7 100644
--- a/src/vs/workbench/contrib/remote/browser/tunnelView.ts
+++ b/src/vs/workbench/contrib/remote/browser/tunnelView.ts
@@ -28,7 +28,7 @@ import { IRemoteExplorerService, TunnelModel, makeAddress, TunnelType, ITunnelIt
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
import { InputBox, MessageType } from 'vs/base/browser/ui/inputbox/inputBox';
-import { attachButtonStyler, attachInputBoxStyler } from 'vs/platform/theme/common/styler';
+import { attachInputBoxStyler } from 'vs/platform/theme/common/styler';
import { once } from 'vs/base/common/functional';
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
import { IThemeService, registerThemingParticipant, ThemeIcon } from 'vs/platform/theme/common/themeService';
@@ -54,6 +54,7 @@ import { IHoverDelegateOptions } from 'vs/base/browser/ui/iconLabel/iconHoverDel
import { IHoverService } from 'vs/workbench/services/hover/browser/hover';
import { STATUS_BAR_HOST_NAME_BACKGROUND } from 'vs/workbench/common/theme';
import { Codicon } from 'vs/base/common/codicons';
+import { defaultButtonStyles } from 'vs/platform/theme/browser/defaultStyles';
export const forwardedPortsViewEnabled = new RawContextKey<boolean>('forwardedPortsViewEnabled', false, nls.localize('tunnel.forwardedPortsViewEnabled', "Whether the Ports view is enabled."));
export const openPreviewEnabledContext = new RawContextKey<boolean>('openPreviewEnabled', false);
@@ -408,10 +409,9 @@ class ActionBarRenderer extends Disposable implements ITableRenderer<ActionBarCe
renderButton(element: ActionBarCell, templateData: IActionBarTemplateData): void {
templateData.container.style.paddingLeft = '7px';
templateData.container.style.height = '28px';
- templateData.button = this._register(new Button(templateData.container));
+ templateData.button = this._register(new Button(templateData.container, defaultButtonStyles));
templateData.button.label = element.label;
templateData.button.element.title = element.tooltip;
- this._register(attachButtonStyler(templateData.button, this.themeService));
this._register(templateData.button.onDidClick(() => {
this.commandService.executeCommand(ForwardPortAction.INLINE_ID);
}));
diff --git a/src/vs/workbench/contrib/scm/browser/scmViewPane.ts b/src/vs/workbench/contrib/scm/browser/scmViewPane.ts
index 85882236c93..d13303d909f 100644
--- a/src/vs/workbench/contrib/scm/browser/scmViewPane.ts
+++ b/src/vs/workbench/contrib/scm/browser/scmViewPane.ts
@@ -24,7 +24,7 @@ import { IAction, ActionRunner, Action, Separator } from 'vs/base/common/actions
import { ActionBar, IActionViewItemProvider } from 'vs/base/browser/ui/actionbar/actionbar';
import { IThemeService, IFileIconTheme, ThemeIcon } from 'vs/platform/theme/common/themeService';
import { isSCMResource, isSCMResourceGroup, connectPrimaryMenuToInlineActionBar, isSCMRepository, isSCMInput, collectContextMenuActions, getActionViewItemProvider, isSCMActionButton } from './util';
-import { attachBadgeStyler, attachButtonStyler } from 'vs/platform/theme/common/styler';
+import { attachBadgeStyler } from 'vs/platform/theme/common/styler';
import { WorkbenchCompressibleObjectTree, IOpenEvent } from 'vs/platform/list/browser/listService';
import { IConfigurationService, ConfigurationTarget, IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration';
import { disposableTimeout, ThrottledDelayer } from 'vs/base/common/async';
@@ -88,6 +88,7 @@ import { DragAndDropController } from 'vs/editor/contrib/dnd/browser/dnd';
import { DropIntoEditorController } from 'vs/editor/contrib/dropIntoEditor/browser/dropIntoEditorContribution';
import { MessageController } from 'vs/editor/contrib/message/browser/messageController';
import { contrastBorder, registerColor } from 'vs/platform/theme/common/colorRegistry';
+import { defaultButtonStyles } from 'vs/platform/theme/browser/defaultStyles';
type TreeElement = ISCMRepository | ISCMInput | ISCMActionButton | ISCMResourceGroup | IResourceNode<ISCMResource, ISCMResourceGroup> | ISCMResource;
@@ -114,7 +115,6 @@ class ActionButtonRenderer implements ICompressibleTreeRenderer<ISCMActionButton
constructor(
@ICommandService private commandService: ICommandService,
@IContextMenuService private contextMenuService: IContextMenuService,
- @IThemeService private themeService: IThemeService,
@INotificationService private notificationService: INotificationService,
) { }
@@ -126,7 +126,7 @@ class ActionButtonRenderer implements ICompressibleTreeRenderer<ISCMActionButton
container.parentElement!.parentElement!.classList.add('cursor-default', 'force-no-hover');
const buttonContainer = append(container, $('.button-container'));
- const actionButton = new SCMActionButton(buttonContainer, this.contextMenuService, this.commandService, this.themeService, this.notificationService);
+ const actionButton = new SCMActionButton(buttonContainer, this.contextMenuService, this.commandService, this.notificationService);
return { actionButton, disposable: Disposable.None, templateDisposable: actionButton };
}
@@ -2511,7 +2511,6 @@ export class SCMActionButton implements IDisposable {
private readonly container: HTMLElement,
private readonly contextMenuService: IContextMenuService,
private readonly commandService: ICommandService,
- private readonly themeService: IThemeService,
private readonly notificationService: INotificationService
) {
}
@@ -2547,15 +2546,16 @@ export class SCMActionButton implements IDisposable {
addPrimaryActionToDropdown: false,
contextMenuProvider: this.contextMenuService,
title: button.command.tooltip,
- supportIcons: true
+ supportIcons: true,
+ ...defaultButtonStyles
});
} else if (button.description) {
// ButtonWithDescription
- this.button = new ButtonWithDescription(this.container, { supportIcons: true, title: button.command.tooltip });
+ this.button = new ButtonWithDescription(this.container, { supportIcons: true, title: button.command.tooltip, ...defaultButtonStyles });
(this.button as ButtonWithDescription).description = button.description;
} else {
// Button
- this.button = new Button(this.container, { supportIcons: true, title: button.command.tooltip });
+ this.button = new Button(this.container, { supportIcons: true, title: button.command.tooltip, ...defaultButtonStyles });
}
this.button.enabled = button.enabled;
@@ -2563,7 +2563,6 @@ export class SCMActionButton implements IDisposable {
this.button.onDidClick(async () => await this.executeCommand(button.command.id, ...(button.command.arguments || [])), null, this.disposables.value);
this.disposables.value!.add(this.button);
- this.disposables.value!.add(attachButtonStyler(this.button, this.themeService));
}
focus(): void {
diff --git a/src/vs/workbench/contrib/testing/browser/testingExplorerView.ts b/src/vs/workbench/contrib/testing/browser/testingExplorerView.ts
index 6f3b60c0027..d8b979e968e 100644
--- a/src/vs/workbench/contrib/testing/browser/testingExplorerView.ts
+++ b/src/vs/workbench/contrib/testing/browser/testingExplorerView.ts
@@ -40,8 +40,8 @@ import { IOpenerService } from 'vs/platform/opener/common/opener';
import { UnmanagedProgress } from 'vs/platform/progress/common/progress';
import { IStorageService, StorageScope, StorageTarget, WillSaveStateReason } from 'vs/platform/storage/common/storage';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
+import { defaultButtonStyles } from 'vs/platform/theme/browser/defaultStyles';
import { foreground } from 'vs/platform/theme/common/colorRegistry';
-import { attachButtonStyler } from 'vs/platform/theme/common/styler';
import { IThemeService, registerThemingParticipant, ThemeIcon } from 'vs/platform/theme/common/themeService';
import { IUriIdentityService } from 'vs/platform/uriIdentity/common/uriIdentity';
import { ViewPane } from 'vs/workbench/browser/parts/views/viewPane';
@@ -991,17 +991,15 @@ class NoTestsForDocumentWidget extends Disposable {
private readonly el: HTMLElement;
constructor(
container: HTMLElement,
- @ITestExplorerFilterState filterState: ITestExplorerFilterState,
- @IThemeService themeService: IThemeService,
+ @ITestExplorerFilterState filterState: ITestExplorerFilterState
) {
super();
const el = this.el = dom.append(container, dom.$('.testing-no-test-placeholder'));
const emptyParagraph = dom.append(el, dom.$('p'));
emptyParagraph.innerText = localize('testingNoTest', 'No tests were found in this file.');
const buttonLabel = localize('testingFindExtension', 'Show Workspace Tests');
- const button = this._register(new Button(el, { title: buttonLabel }));
+ const button = this._register(new Button(el, { title: buttonLabel, ...defaultButtonStyles }));
button.label = buttonLabel;
- this._register(attachButtonStyler(button, themeService));
this._register(button.onDidClick(() => filterState.toggleFilteringFor(TestFilterTerm.CurrentDoc, false)));
}
diff --git a/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts b/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts
index 95566ec9cab..23b3b86c1c6 100644
--- a/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts
+++ b/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts
@@ -39,7 +39,6 @@ import { GroupDirection, GroupsOrder, IEditorGroupsService } from 'vs/workbench/
import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput';
import { ILink, LinkedText } from 'vs/base/common/linkedText';
import { Button } from 'vs/base/browser/ui/button/button';
-import { attachButtonStyler } from 'vs/platform/theme/common/styler';
import { Link } from 'vs/platform/opener/browser/link';
import { renderFormattedText } from 'vs/base/browser/formattedTextRenderer';
import { IWebviewService } from 'vs/workbench/contrib/webview/browser/webview';
@@ -68,6 +67,7 @@ import { restoreWalkthroughsConfigurationKey, RestoreWalkthroughsConfigurationVa
import { GettingStartedDetailsRenderer } from 'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedDetailsRenderer';
import { IAccessibilityService } from 'vs/platform/accessibility/common/accessibility';
import { renderLabelWithIcons } from 'vs/base/browser/ui/iconLabel/iconLabels';
+import { defaultButtonStyles } from 'vs/platform/theme/browser/defaultStyles';
const SLIDE_TRANSITION_TIME_MS = 250;
const configurationKey = 'workbench.startupEditor';
@@ -1184,7 +1184,7 @@ export class GettingStartedPage extends EditorPane {
if (linkedText.nodes.length === 1 && typeof linkedText.nodes[0] !== 'string') {
const node = linkedText.nodes[0];
const buttonContainer = append(container, $('.button-container'));
- const button = new Button(buttonContainer, { title: node.title, supportIcons: true });
+ const button = new Button(buttonContainer, { title: node.title, supportIcons: true, ...defaultButtonStyles });
const isCommand = node.href.startsWith('command:');
const command = node.href.replace(/command:(toSide:)?/, 'command:');
@@ -1204,7 +1204,6 @@ export class GettingStartedPage extends EditorPane {
}
this.detailsPageDisposables.add(button);
- this.detailsPageDisposables.add(attachButtonStyler(button, this.themeService));
} else {
const p = append(container, $('p'));
for (const node of linkedText.nodes) {
diff --git a/src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts b/src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts
index 679be9104d5..6e17fd9d353 100644
--- a/src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts
+++ b/src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts
@@ -35,7 +35,7 @@ import { IStorageService } from 'vs/platform/storage/common/storage';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { buttonBackground, buttonSecondaryBackground, editorErrorForeground } from 'vs/platform/theme/common/colorRegistry';
import { ISingleFolderWorkspaceIdentifier, IWorkspaceContextService, toWorkspaceIdentifier, WorkbenchState } from 'vs/platform/workspace/common/workspace';
-import { attachButtonStyler, attachInputBoxStyler, attachStylerCallback } from 'vs/platform/theme/common/styler';
+import { attachInputBoxStyler, attachStylerCallback } from 'vs/platform/theme/common/styler';
import { IThemeService, ThemeIcon } from 'vs/platform/theme/common/themeService';
import { IWorkspaceTrustManagementService } from 'vs/platform/workspace/common/workspaceTrust';
import { EditorPane } from 'vs/workbench/browser/parts/editor/editorPane';
@@ -55,6 +55,7 @@ import { hasDriveLetter, toSlashes } from 'vs/base/common/extpath';
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { IProductService } from 'vs/platform/product/common/productService';
import { registerIcon } from 'vs/platform/theme/common/iconRegistry';
+import { defaultButtonStyles } from 'vs/platform/theme/browser/defaultStyles';
export const shieldIcon = registerIcon('workspace-trust-banner', Codicon.shield, localize('shieldIcon', 'Icon for workspace trust ion the banner.'));
@@ -93,7 +94,6 @@ class WorkspaceTrustedUrisTable extends Disposable {
@IWorkspaceTrustManagementService private readonly workspaceTrustManagementService: IWorkspaceTrustManagementService,
@IUriIdentityService private readonly uriService: IUriIdentityService,
@ILabelService private readonly labelService: ILabelService,
- @IThemeService private readonly themeService: IThemeService,
@IFileDialogService private readonly fileDialogService: IFileDialogService
) {
super();
@@ -164,11 +164,9 @@ class WorkspaceTrustedUrisTable extends Disposable {
}));
const buttonBar = this._register(new ButtonBar(addButtonBarElement));
- const addButton = this._register(buttonBar.addButton({ title: localize('addButton', "Add Folder") }));
+ const addButton = this._register(buttonBar.addButton({ title: localize('addButton', "Add Folder"), ...defaultButtonStyles }));
addButton.label = localize('addButton', "Add Folder");
- this._register(attachButtonStyler(addButton, this.themeService));
-
this._register(addButton.onDidClick(async () => {
const uri = await this.fileDialogService.showOpenDialog({
canSelectFiles: false,
@@ -1022,9 +1020,10 @@ export class WorkspaceTrustEditor extends EditorPane {
buttonBar.addButtonWithDropdown({
title: true,
actions: action.menu ?? [],
- contextMenuProvider: this.contextMenuService
+ contextMenuProvider: this.contextMenuService,
+ ...defaultButtonStyles
}) :
- buttonBar.addButton();
+ buttonBar.addButton(defaultButtonStyles);
button.label = action.label;
button.enabled = enabled !== undefined ? enabled : action.enabled;
@@ -1036,8 +1035,6 @@ export class WorkspaceTrustEditor extends EditorPane {
action.run();
}));
-
- this.rerenderDisposables.add(attachButtonStyler(button, this.themeService));
}
}