Skip to content

Commit 893bf4e

Browse files
committed
Not possible to explicitly change the foreground text color for widgets. Fixes microsoft#76274
1 parent f0a214e commit 893bf4e

8 files changed

Lines changed: 36 additions & 13 deletions

File tree

src/vs/editor/contrib/find/findWidget.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import { CONTEXT_FIND_INPUT_FOCUSED, CONTEXT_REPLACE_INPUT_FOCUSED, FIND_IDS, MA
2727
import { FindReplaceState, FindReplaceStateChangedEvent } from 'vs/editor/contrib/find/findState';
2828
import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
2929
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
30-
import { contrastBorder, editorFindMatch, editorFindMatchBorder, editorFindMatchHighlight, editorFindMatchHighlightBorder, editorFindRangeHighlight, editorFindRangeHighlightBorder, editorWidgetBackground, editorWidgetBorder, editorWidgetResizeBorder, errorForeground, inputActiveOptionBorder, inputBackground, inputBorder, inputForeground, inputValidationErrorBackground, inputValidationErrorBorder, inputValidationErrorForeground, inputValidationInfoBackground, inputValidationInfoBorder, inputValidationInfoForeground, inputValidationWarningBackground, inputValidationWarningBorder, inputValidationWarningForeground, widgetShadow } from 'vs/platform/theme/common/colorRegistry';
30+
import { contrastBorder, editorFindMatch, editorFindMatchBorder, editorFindMatchHighlight, editorFindMatchHighlightBorder, editorFindRangeHighlight, editorFindRangeHighlightBorder, editorWidgetBackground, editorWidgetBorder, editorWidgetResizeBorder, errorForeground, inputActiveOptionBorder, inputBackground, inputBorder, inputForeground, inputValidationErrorBackground, inputValidationErrorBorder, inputValidationErrorForeground, inputValidationInfoBackground, inputValidationInfoBorder, inputValidationInfoForeground, inputValidationWarningBackground, inputValidationWarningBorder, inputValidationWarningForeground, widgetShadow, editorWidgetForeground } from 'vs/platform/theme/common/colorRegistry';
3131
import { ITheme, IThemeService, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
3232
import { ContextScopedFindInput, ContextScopedHistoryInputBox } from 'vs/platform/browser/contextScopedHistoryWidget';
3333
import { AccessibilitySupport } from 'vs/platform/accessibility/common/accessibility';
@@ -1193,6 +1193,11 @@ registerThemingParticipant((theme, collector) => {
11931193
collector.addRule(`.monaco-editor .find-widget { border: 2px solid ${hcBorder}; }`);
11941194
}
11951195

1196+
const foreground = theme.getColor(editorWidgetForeground);
1197+
if (foreground) {
1198+
collector.addRule(`.monaco-editor .find-widget { color: ${foreground}; }`);
1199+
}
1200+
11961201
const error = theme.getColor(errorForeground);
11971202
if (error) {
11981203
collector.addRule(`.monaco-editor .find-widget.no-results .matchesCount { color: ${error}; }`);

src/vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiati
2727
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
2828
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
2929
import { IOpenerService } from 'vs/platform/opener/common/opener';
30-
import { contrastBorder, editorWidgetBackground, widgetShadow } from 'vs/platform/theme/common/colorRegistry';
30+
import { contrastBorder, editorWidgetBackground, widgetShadow, editorWidgetForeground } from 'vs/platform/theme/common/colorRegistry';
3131
import { registerThemingParticipant } from 'vs/platform/theme/common/themeService';
3232
import { AccessibilitySupport } from 'vs/platform/accessibility/common/accessibility';
3333
import { AccessibilityHelpNLS } from 'vs/editor/common/standaloneStrings';
@@ -371,6 +371,11 @@ registerThemingParticipant((theme, collector) => {
371371
if (widgetBackground) {
372372
collector.addRule(`.monaco-editor .accessibilityHelpWidget { background-color: ${widgetBackground}; }`);
373373
}
374+
const widgetForeground = theme.getColor(editorWidgetForeground);
375+
if (widgetForeground) {
376+
collector.addRule(`.monaco-editor .accessibilityHelpWidget { color: ${widgetForeground}; }`);
377+
}
378+
374379

375380
const widgetShadowColor = theme.getColor(widgetShadow);
376381
if (widgetShadowColor) {

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,8 @@ export const editorForeground = registerColor('editor.foreground', { light: '#33
293293
* Editor widgets
294294
*/
295295
export const editorWidgetBackground = registerColor('editorWidget.background', { dark: '#252526', light: '#F3F3F3', hc: '#0C141F' }, nls.localize('editorWidgetBackground', 'Background color of editor widgets, such as find/replace.'));
296+
export const editorWidgetForeground = registerColor('editorWidget.foreground', { dark: foreground, light: foreground, hc: foreground }, nls.localize('editorWidgetForeground', 'Foreground color of editor widgets, such as find/replace.'));
297+
296298
export const editorWidgetBorder = registerColor('editorWidget.border', { dark: '#454545', light: '#C8C8C8', hc: contrastBorder }, nls.localize('editorWidgetBorder', 'Border color of editor widgets. The color is only used if the widget chooses to have a border and if the color is not overridden by a widget.'));
297299

298300
export const editorWidgetResizeBorder = registerColor('editorWidget.resizeBorder', { light: null, dark: null, hc: null }, nls.localize('editorWidgetResizeBorder', "Border color of the resize bar of editor widgets. The color is only used if the widget chooses to have a resize border and if the color is not overridden by a widget."));

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import { ITheme, IThemeService } from 'vs/platform/theme/common/themeService';
7-
import { focusBorder, inputBackground, inputForeground, ColorIdentifier, selectForeground, selectBackground, selectListBackground, selectBorder, inputBorder, foreground, editorBackground, contrastBorder, inputActiveOptionBorder, listFocusBackground, listFocusForeground, listActiveSelectionBackground, listActiveSelectionForeground, listInactiveSelectionForeground, listInactiveSelectionBackground, listInactiveFocusBackground, listHoverBackground, listHoverForeground, listDropBackground, pickerGroupBorder, pickerGroupForeground, widgetShadow, inputValidationInfoBorder, inputValidationInfoBackground, inputValidationWarningBorder, inputValidationWarningBackground, inputValidationErrorBorder, inputValidationErrorBackground, activeContrastBorder, buttonForeground, buttonBackground, buttonHoverBackground, ColorFunction, badgeBackground, badgeForeground, progressBarBackground, breadcrumbsForeground, breadcrumbsFocusForeground, breadcrumbsActiveSelectionForeground, breadcrumbsBackground, editorWidgetBorder, inputValidationInfoForeground, inputValidationWarningForeground, inputValidationErrorForeground, menuForeground, menuBackground, menuSelectionForeground, menuSelectionBackground, menuSelectionBorder, menuBorder, menuSeparatorBackground, darken, listFilterWidgetOutline, listFilterWidgetNoMatchesOutline, listFilterWidgetBackground, editorWidgetBackground, treeIndentGuidesStroke } from 'vs/platform/theme/common/colorRegistry';
7+
import { focusBorder, inputBackground, inputForeground, ColorIdentifier, selectForeground, selectBackground, selectListBackground, selectBorder, inputBorder, foreground, editorBackground, contrastBorder, inputActiveOptionBorder, listFocusBackground, listFocusForeground, listActiveSelectionBackground, listActiveSelectionForeground, listInactiveSelectionForeground, listInactiveSelectionBackground, listInactiveFocusBackground, listHoverBackground, listHoverForeground, listDropBackground, pickerGroupBorder, pickerGroupForeground, widgetShadow, inputValidationInfoBorder, inputValidationInfoBackground, inputValidationWarningBorder, inputValidationWarningBackground, inputValidationErrorBorder, inputValidationErrorBackground, activeContrastBorder, buttonForeground, buttonBackground, buttonHoverBackground, ColorFunction, badgeBackground, badgeForeground, progressBarBackground, breadcrumbsForeground, breadcrumbsFocusForeground, breadcrumbsActiveSelectionForeground, breadcrumbsBackground, editorWidgetBorder, inputValidationInfoForeground, inputValidationWarningForeground, inputValidationErrorForeground, menuForeground, menuBackground, menuSelectionForeground, menuSelectionBackground, menuSelectionBorder, menuBorder, menuSeparatorBackground, darken, listFilterWidgetOutline, listFilterWidgetNoMatchesOutline, listFilterWidgetBackground, editorWidgetBackground, treeIndentGuidesStroke, editorWidgetForeground } from 'vs/platform/theme/common/colorRegistry';
88
import { IDisposable } from 'vs/base/common/lifecycle';
99
import { Color } from 'vs/base/common/color';
1010
import { mixin } from 'vs/base/common/objects';
@@ -341,7 +341,7 @@ export interface IDialogStyleOverrides extends IButtonStyleOverrides {
341341

342342
export const defaultDialogStyles = <IDialogStyleOverrides>{
343343
dialogBackground: editorWidgetBackground,
344-
dialogForeground: foreground,
344+
dialogForeground: editorWidgetForeground,
345345
dialogShadow: widgetShadow,
346346
dialogBorder: contrastBorder,
347347
buttonForeground: buttonForeground,

src/vs/workbench/common/theme.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import * as nls from 'vs/nls';
7-
import { registerColor, editorBackground, contrastBorder, transparent, editorWidgetBackground, textLinkForeground, lighten, darken, focusBorder, activeContrastBorder } from 'vs/platform/theme/common/colorRegistry';
7+
import { registerColor, editorBackground, contrastBorder, transparent, editorWidgetBackground, textLinkForeground, lighten, darken, focusBorder, activeContrastBorder, editorWidgetForeground } from 'vs/platform/theme/common/colorRegistry';
88
import { Disposable } from 'vs/base/common/lifecycle';
99
import { IThemeService, ITheme } from 'vs/platform/theme/common/themeService';
1010
import { Color } from 'vs/base/common/color';
@@ -518,9 +518,9 @@ export const NOTIFICATIONS_TOAST_BORDER = registerColor('notificationToast.borde
518518
}, nls.localize('notificationToastBorder', "Notification toast border color. Notifications slide in from the bottom right of the window."));
519519

520520
export const NOTIFICATIONS_FOREGROUND = registerColor('notifications.foreground', {
521-
dark: null,
522-
light: null,
523-
hc: null
521+
dark: editorWidgetForeground,
522+
light: editorWidgetForeground,
523+
hc: editorWidgetForeground
524524
}, nls.localize('notificationsForeground', "Notifications foreground color. Notifications slide in from the bottom right of the window."));
525525

526526
export const NOTIFICATIONS_BACKGROUND = registerColor('notifications.background', {

src/vs/workbench/contrib/codeEditor/browser/accessibility/accessibility.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiati
2727
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
2828
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
2929
import { IOpenerService } from 'vs/platform/opener/common/opener';
30-
import { contrastBorder, editorWidgetBackground, widgetShadow } from 'vs/platform/theme/common/colorRegistry';
30+
import { contrastBorder, editorWidgetBackground, widgetShadow, editorWidgetForeground } from 'vs/platform/theme/common/colorRegistry';
3131
import { registerThemingParticipant } from 'vs/platform/theme/common/themeService';
3232
import { AccessibilitySupport } from 'vs/platform/accessibility/common/accessibility';
3333

@@ -321,6 +321,11 @@ registerThemingParticipant((theme, collector) => {
321321
collector.addRule(`.monaco-editor .accessibilityHelpWidget { background-color: ${widgetBackground}; }`);
322322
}
323323

324+
const widgetForeground = theme.getColor(editorWidgetForeground);
325+
if (widgetBackground) {
326+
collector.addRule(`.monaco-editor .accessibilityHelpWidget { color: ${widgetForeground}; }`);
327+
}
328+
324329
const widgetShadowColor = theme.getColor(widgetShadow);
325330
if (widgetShadowColor) {
326331
collector.addRule(`.monaco-editor .accessibilityHelpWidget { box-shadow: 0 2px 8px ${widgetShadowColor}; }`);

src/vs/workbench/contrib/feedback/browser/feedback.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { ICommandService } from 'vs/platform/commands/common/commands';
1313
import { IIntegrityService } from 'vs/workbench/services/integrity/common/integrity';
1414
import { IThemeService, registerThemingParticipant, ITheme, ICssStyleCollector } from 'vs/platform/theme/common/themeService';
1515
import { attachButtonStyler, attachStylerCallback } from 'vs/platform/theme/common/styler';
16-
import { editorWidgetBackground, widgetShadow, inputBorder, inputForeground, inputBackground, inputActiveOptionBorder, editorBackground, buttonBackground, contrastBorder, darken } from 'vs/platform/theme/common/colorRegistry';
16+
import { editorWidgetBackground, editorWidgetForeground, widgetShadow, inputBorder, inputForeground, inputBackground, inputActiveOptionBorder, editorBackground, buttonBackground, contrastBorder, darken } from 'vs/platform/theme/common/colorRegistry';
1717
import { IAnchor } from 'vs/base/browser/ui/contextview/contextview';
1818
import { Button } from 'vs/base/browser/ui/button/button';
1919
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
@@ -278,9 +278,10 @@ export class FeedbackDropdown extends Dropdown {
278278

279279
this.sendButton.onDidClick(() => this.onSubmit());
280280

281-
disposables.add(attachStylerCallback(this.themeService, { widgetShadow, editorWidgetBackground, inputBackground, inputForeground, inputBorder, editorBackground, contrastBorder }, colors => {
281+
disposables.add(attachStylerCallback(this.themeService, { widgetShadow, editorWidgetBackground, editorWidgetForeground, inputBackground, inputForeground, inputBorder, editorBackground, contrastBorder }, colors => {
282282
if (this.feedbackForm) {
283283
this.feedbackForm.style.backgroundColor = colors.editorWidgetBackground ? colors.editorWidgetBackground.toString() : null;
284+
this.feedbackForm.style.color = colors.editorWidgetForeground ? colors.editorWidgetForeground.toString() : null;
284285
this.feedbackForm.style.boxShadow = colors.widgetShadow ? `0 0 8px ${colors.widgetShadow}` : null;
285286
}
286287
if (this.feedbackDescriptionInput) {

src/vs/workbench/contrib/preferences/browser/keybindingWidgets.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
2020
import { ICodeEditor, IOverlayWidget, IOverlayWidgetPosition } from 'vs/editor/browser/editorBrowser';
2121
import { attachInputBoxStyler, attachStylerCallback } from 'vs/platform/theme/common/styler';
2222
import { IThemeService } from 'vs/platform/theme/common/themeService';
23-
import { editorWidgetBackground, widgetShadow } from 'vs/platform/theme/common/colorRegistry';
23+
import { editorWidgetBackground, editorWidgetForeground, widgetShadow } from 'vs/platform/theme/common/colorRegistry';
2424
import { ScrollType } from 'vs/editor/common/editorCommon';
2525
import { SearchWidget, SearchOptions } from 'vs/workbench/contrib/preferences/browser/preferencesWidgets';
2626
import { withNullAsUndefined } from 'vs/base/common/types';
@@ -227,12 +227,17 @@ export class DefineKeybindingWidget extends Widget {
227227
const message = nls.localize('defineKeybinding.initial', "Press desired key combination and then press ENTER.");
228228
dom.append(this._domNode.domNode, dom.$('.message', undefined, message));
229229

230-
this._register(attachStylerCallback(this.themeService, { editorWidgetBackground, widgetShadow }, colors => {
230+
this._register(attachStylerCallback(this.themeService, { editorWidgetBackground, editorWidgetForeground, widgetShadow }, colors => {
231231
if (colors.editorWidgetBackground) {
232232
this._domNode.domNode.style.backgroundColor = colors.editorWidgetBackground.toString();
233233
} else {
234234
this._domNode.domNode.style.backgroundColor = null;
235235
}
236+
if (colors.editorWidgetForeground) {
237+
this._domNode.domNode.style.color = colors.editorWidgetForeground.toString();
238+
} else {
239+
this._domNode.domNode.style.color = null;
240+
}
236241

237242
if (colors.widgetShadow) {
238243
this._domNode.domNode.style.boxShadow = `0 2px 8px ${colors.widgetShadow}`;

0 commit comments

Comments
 (0)