Skip to content

Commit 63f8550

Browse files
authored
Adopt css colors for notification list (microsoft#166725)
1 parent 796ee2b commit 63f8550

File tree

2 files changed

+12
-21
lines changed

2 files changed

+12
-21
lines changed

src/vs/workbench/browser/parts/notifications/media/notificationsList.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55

66
/** Notification: Container */
77

8+
.monaco-workbench .notifications-list-container {
9+
color: var(--vscode-notifications-foreground);
10+
background: var(--vscode-notifications-background);
11+
outline-color: var(--vscode-contrastBorder);
12+
}
13+
814
.monaco-workbench .notifications-list-container .notification-list-item {
915
display: flex;
1016
flex-direction: column;

src/vs/workbench/browser/parts/notifications/notificationsList.ts

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,23 @@ import { isAncestor, trackFocus } from 'vs/base/browser/dom';
99
import { WorkbenchList } from 'vs/platform/list/browser/listService';
1010
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
1111
import { IListOptions } from 'vs/base/browser/ui/list/listWidget';
12-
import { NOTIFICATIONS_LINKS, NOTIFICATIONS_BACKGROUND, NOTIFICATIONS_FOREGROUND, NOTIFICATIONS_ERROR_ICON_FOREGROUND, NOTIFICATIONS_WARNING_ICON_FOREGROUND, NOTIFICATIONS_INFO_ICON_FOREGROUND } from 'vs/workbench/common/theme';
13-
import { IThemeService, registerThemingParticipant, Themable } from 'vs/platform/theme/common/themeService';
14-
import { contrastBorder, focusBorder } from 'vs/platform/theme/common/colorRegistry';
12+
import { NOTIFICATIONS_LINKS, NOTIFICATIONS_BACKGROUND, NOTIFICATIONS_ERROR_ICON_FOREGROUND, NOTIFICATIONS_WARNING_ICON_FOREGROUND, NOTIFICATIONS_INFO_ICON_FOREGROUND } from 'vs/workbench/common/theme';
13+
import { registerThemingParticipant } from 'vs/platform/theme/common/themeService';
14+
import { focusBorder } from 'vs/platform/theme/common/colorRegistry';
1515
import { INotificationViewItem } from 'vs/workbench/common/notifications';
1616
import { NotificationsListDelegate, NotificationRenderer } from 'vs/workbench/browser/parts/notifications/notificationsViewer';
1717
import { NotificationActionRunner, CopyNotificationMessageAction } from 'vs/workbench/browser/parts/notifications/notificationsActions';
1818
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
1919
import { assertIsDefined, assertAllDefined } from 'vs/base/common/types';
2020
import { Codicon } from 'vs/base/common/codicons';
2121
import { NotificationFocusedContext } from 'vs/workbench/common/contextkeys';
22+
import { Disposable } from 'vs/base/common/lifecycle';
2223

2324
export interface INotificationsListOptions extends IListOptions<INotificationViewItem> {
2425
widgetAriaLabel?: string;
2526
}
2627

27-
export class NotificationsList extends Themable {
28+
export class NotificationsList extends Disposable {
2829

2930
private listContainer: HTMLElement | undefined;
3031
private list: WorkbenchList<INotificationViewItem> | undefined;
@@ -36,10 +37,9 @@ export class NotificationsList extends Themable {
3637
private readonly container: HTMLElement,
3738
private readonly options: INotificationsListOptions,
3839
@IInstantiationService private readonly instantiationService: IInstantiationService,
39-
@IThemeService themeService: IThemeService,
4040
@IContextMenuService private readonly contextMenuService: IContextMenuService
4141
) {
42-
super(themeService);
42+
super();
4343
}
4444

4545
show(focus?: boolean): void {
@@ -153,8 +153,6 @@ export class NotificationsList extends Themable {
153153
}));
154154

155155
this.container.appendChild(this.listContainer);
156-
157-
this.updateStyles();
158156
}
159157

160158
updateNotificationsList(start: number, deleteCount: number, items: INotificationViewItem[] = []) {
@@ -252,19 +250,6 @@ export class NotificationsList extends Themable {
252250
return isAncestor(document.activeElement, this.listContainer);
253251
}
254252

255-
protected override updateStyles(): void {
256-
if (this.listContainer) {
257-
const foreground = this.getColor(NOTIFICATIONS_FOREGROUND);
258-
this.listContainer.style.color = foreground ? foreground : '';
259-
260-
const background = this.getColor(NOTIFICATIONS_BACKGROUND);
261-
this.listContainer.style.background = background ? background : '';
262-
263-
const outlineColor = this.getColor(contrastBorder);
264-
this.listContainer.style.outlineColor = outlineColor ? outlineColor : '';
265-
}
266-
}
267-
268253
layout(width: number, maxHeight?: number): void {
269254
if (this.listContainer && this.list) {
270255
this.listContainer.style.width = `${width}px`;

0 commit comments

Comments
 (0)