Skip to content

Commit f9bad09

Browse files
author
Miguel Solorio
authored
Add button separator color token (microsoft#155103)
* Add button separator color token * Fix compilation errors
1 parent 50056f3 commit f9bad09

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

src/vs/base/browser/ui/button/button.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export interface IButtonStyles {
2828
buttonBackground?: Color;
2929
buttonHoverBackground?: Color;
3030
buttonForeground?: Color;
31+
buttonSeparator?: Color;
3132
buttonSecondaryBackground?: Color;
3233
buttonSecondaryHoverBackground?: Color;
3334
buttonSecondaryForeground?: Color;
@@ -37,6 +38,7 @@ export interface IButtonStyles {
3738
const defaultOptions: IButtonStyles = {
3839
buttonBackground: Color.fromHex('#0E639C'),
3940
buttonHoverBackground: Color.fromHex('#006BB3'),
41+
buttonSeparator: Color.white,
4042
buttonForeground: Color.white
4143
};
4244

@@ -315,7 +317,7 @@ export class ButtonWithDropdown extends Disposable implements IButton {
315317

316318
// Separator
317319
this.separatorContainer.style.backgroundColor = styles.buttonBackground?.toString() ?? '';
318-
this.separator.style.backgroundColor = styles.buttonForeground?.toString() ?? '';
320+
this.separator.style.backgroundColor = styles.buttonSeparator?.toString() ?? '';
319321
}
320322

321323
focus(): void {

src/vs/platform/theme/common/colorRegistry.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ export const checkboxForeground = registerColor('checkbox.foreground', { dark: s
266266
export const checkboxBorder = registerColor('checkbox.border', { dark: selectBorder, light: selectBorder, hcDark: selectBorder, hcLight: selectBorder }, nls.localize('checkbox.border', "Border color of checkbox widget."));
267267

268268
export const buttonForeground = registerColor('button.foreground', { dark: Color.white, light: Color.white, hcDark: Color.white, hcLight: Color.white }, nls.localize('buttonForeground', "Button foreground color."));
269+
export const buttonSeparator = registerColor('button.separator', { dark: transparent(buttonForeground, .4), light: transparent(buttonForeground, .4), hcDark: transparent(buttonForeground, .4), hcLight: transparent(buttonForeground, .4) }, nls.localize('buttonSeparator', "Button separator color."));
269270
export const buttonBackground = registerColor('button.background', { dark: '#0E639C', light: '#007ACC', hcDark: null, hcLight: '#0F4A85' }, nls.localize('buttonBackground', "Button background color."));
270271
export const buttonHoverBackground = registerColor('button.hoverBackground', { dark: lighten(buttonBackground, 0.2), light: darken(buttonBackground, 0.2), hcDark: null, hcLight: null }, nls.localize('buttonHoverBackground', "Button background color when hovering."));
271272
export const buttonBorder = registerColor('button.border', { dark: contrastBorder, light: contrastBorder, hcDark: contrastBorder, hcLight: contrastBorder }, nls.localize('buttonBorder', "Button border color."));

src/vs/platform/theme/common/styler.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import { Color } from 'vs/base/common/color';
77
import { IDisposable } from 'vs/base/common/lifecycle';
88
import { IThemable, styleFn } from 'vs/base/common/styler';
9-
import { activeContrastBorder, badgeBackground, badgeForeground, breadcrumbsActiveSelectionForeground, breadcrumbsBackground, breadcrumbsFocusForeground, breadcrumbsForeground, buttonBackground, buttonBorder, buttonForeground, buttonHoverBackground, buttonSecondaryBackground, buttonSecondaryForeground, buttonSecondaryHoverBackground, ColorIdentifier, ColorTransform, ColorValue, contrastBorder, editorWidgetBackground, editorWidgetBorder, editorWidgetForeground, focusBorder, inputActiveOptionBackground, inputActiveOptionBorder, inputActiveOptionForeground, inputBackground, inputBorder, inputForeground, inputValidationErrorBackground, inputValidationErrorBorder, inputValidationErrorForeground, inputValidationInfoBackground, inputValidationInfoBorder, inputValidationInfoForeground, inputValidationWarningBackground, inputValidationWarningBorder, inputValidationWarningForeground, keybindingLabelBackground, keybindingLabelBorder, keybindingLabelBottomBorder, keybindingLabelForeground, listActiveSelectionBackground, listActiveSelectionForeground, listActiveSelectionIconForeground, listDropBackground, listFilterWidgetBackground, listFilterWidgetNoMatchesOutline, listFilterWidgetOutline, listFocusBackground, listFocusForeground, listFocusOutline, listHoverBackground, listHoverForeground, listInactiveFocusBackground, listInactiveFocusOutline, listInactiveSelectionBackground, listInactiveSelectionForeground, listInactiveSelectionIconForeground, menuBackground, menuBorder, menuForeground, menuSelectionBackground, menuSelectionBorder, menuSelectionForeground, menuSeparatorBackground, pickerGroupForeground, problemsErrorIconForeground, problemsInfoIconForeground, problemsWarningIconForeground, progressBarBackground, quickInputListFocusBackground, quickInputListFocusForeground, quickInputListFocusIconForeground, resolveColorValue, scrollbarShadow, scrollbarSliderActiveBackground, scrollbarSliderBackground, scrollbarSliderHoverBackground, selectBackground, selectBorder, selectForeground, selectListBackground, checkboxBackground, checkboxBorder, checkboxForeground, tableColumnsBorder, tableOddRowsBackgroundColor, textLinkForeground, treeIndentGuidesStroke, widgetShadow, listFocusAndSelectionOutline } from 'vs/platform/theme/common/colorRegistry';
9+
import { activeContrastBorder, badgeBackground, badgeForeground, breadcrumbsActiveSelectionForeground, breadcrumbsBackground, breadcrumbsFocusForeground, breadcrumbsForeground, buttonBackground, buttonBorder, buttonForeground, buttonHoverBackground, buttonSecondaryBackground, buttonSecondaryForeground, buttonSecondaryHoverBackground, ColorIdentifier, ColorTransform, ColorValue, contrastBorder, editorWidgetBackground, editorWidgetBorder, editorWidgetForeground, focusBorder, inputActiveOptionBackground, inputActiveOptionBorder, inputActiveOptionForeground, inputBackground, inputBorder, inputForeground, inputValidationErrorBackground, inputValidationErrorBorder, inputValidationErrorForeground, inputValidationInfoBackground, inputValidationInfoBorder, inputValidationInfoForeground, inputValidationWarningBackground, inputValidationWarningBorder, inputValidationWarningForeground, keybindingLabelBackground, keybindingLabelBorder, keybindingLabelBottomBorder, keybindingLabelForeground, listActiveSelectionBackground, listActiveSelectionForeground, listActiveSelectionIconForeground, listDropBackground, listFilterWidgetBackground, listFilterWidgetNoMatchesOutline, listFilterWidgetOutline, listFocusBackground, listFocusForeground, listFocusOutline, listHoverBackground, listHoverForeground, listInactiveFocusBackground, listInactiveFocusOutline, listInactiveSelectionBackground, listInactiveSelectionForeground, listInactiveSelectionIconForeground, menuBackground, menuBorder, menuForeground, menuSelectionBackground, menuSelectionBorder, menuSelectionForeground, menuSeparatorBackground, pickerGroupForeground, problemsErrorIconForeground, problemsInfoIconForeground, problemsWarningIconForeground, progressBarBackground, quickInputListFocusBackground, quickInputListFocusForeground, quickInputListFocusIconForeground, resolveColorValue, scrollbarShadow, scrollbarSliderActiveBackground, scrollbarSliderBackground, scrollbarSliderHoverBackground, selectBackground, selectBorder, selectForeground, selectListBackground, checkboxBackground, checkboxBorder, checkboxForeground, tableColumnsBorder, tableOddRowsBackgroundColor, textLinkForeground, treeIndentGuidesStroke, widgetShadow, listFocusAndSelectionOutline, buttonSeparator } from 'vs/platform/theme/common/colorRegistry';
1010
import { isHighContrast } from 'vs/platform/theme/common/theme';
1111
import { IColorTheme, IThemeService } from 'vs/platform/theme/common/themeService';
1212

@@ -225,6 +225,7 @@ export const defaultListStyles: IColorMapping = {
225225

226226
export interface IButtonStyleOverrides extends IStyleOverrides {
227227
buttonForeground?: ColorIdentifier;
228+
buttonSeparator?: ColorIdentifier;
228229
buttonBackground?: ColorIdentifier;
229230
buttonHoverBackground?: ColorIdentifier;
230231
buttonSecondaryForeground?: ColorIdentifier;
@@ -236,6 +237,7 @@ export interface IButtonStyleOverrides extends IStyleOverrides {
236237
export function attachButtonStyler(widget: IThemable, themeService: IThemeService, style?: IButtonStyleOverrides): IDisposable {
237238
return attachStyler(themeService, {
238239
buttonForeground: style?.buttonForeground || buttonForeground,
240+
buttonSeparator: style?.buttonSeparator || buttonSeparator,
239241
buttonBackground: style?.buttonBackground || buttonBackground,
240242
buttonHoverBackground: style?.buttonHoverBackground || buttonHoverBackground,
241243
buttonSecondaryForeground: style?.buttonSecondaryForeground || buttonSecondaryForeground,
@@ -349,6 +351,7 @@ export const defaultDialogStyles = <IDialogStyleOverrides>{
349351
dialogShadow: widgetShadow,
350352
dialogBorder: contrastBorder,
351353
buttonForeground: buttonForeground,
354+
buttonSeparator: buttonSeparator,
352355
buttonBackground: buttonBackground,
353356
buttonSecondaryBackground: buttonSecondaryBackground,
354357
buttonSecondaryForeground: buttonSecondaryForeground,

0 commit comments

Comments
 (0)