Skip to content

Commit 41de158

Browse files
author
Benjamin Pasero
committed
Add sideBarSectionHeader.foreground color key and... (fixes microsoft#27118)
1 parent 8e0f07f commit 41de158

5 files changed

Lines changed: 21 additions & 7 deletions

File tree

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ export interface IHeaderViewOptions extends IHeaderViewStyles {
107107
}
108108

109109
export interface IHeaderViewStyles {
110+
headerForeground?: Color;
110111
headerBackground?: Color;
111112
headerHighContrastBorder?: Color;
112113
}
@@ -123,6 +124,7 @@ export abstract class HeaderView extends View {
123124
protected header: HTMLElement;
124125
protected body: HTMLElement;
125126

127+
private headerForeground: Color;
126128
private headerBackground: Color;
127129
private headerHighContrastBorder;
128130

@@ -132,11 +134,13 @@ export abstract class HeaderView extends View {
132134
this._headerSize = types.isUndefined(opts.headerSize) ? 22 : opts.headerSize;
133135
this._showHeader = this._headerSize > 0;
134136

137+
this.headerForeground = opts.headerForeground;
135138
this.headerBackground = opts.headerBackground || headerDefaultOpts.headerBackground;
136139
this.headerHighContrastBorder = opts.headerHighContrastBorder;
137140
}
138141

139142
style(styles: IHeaderViewStyles): void {
143+
this.headerForeground = styles.headerForeground;
140144
this.headerBackground = styles.headerBackground;
141145
this.headerHighContrastBorder = styles.headerHighContrastBorder;
142146

@@ -149,9 +153,11 @@ export abstract class HeaderView extends View {
149153

150154
protected applyStyles(): void {
151155
if (this.header) {
156+
const headerForegroundColor = this.headerForeground ? this.headerForeground.toString() : null;
152157
const headerBackgroundColor = this.headerBackground ? this.headerBackground.toString() : null;
153158
const headerHighContrastBorderColor = this.headerHighContrastBorder ? this.headerHighContrastBorder.toString() : null;
154159

160+
this.header.style.color = headerForegroundColor;
155161
this.header.style.backgroundColor = headerBackgroundColor;
156162
this.header.style.borderTop = headerHighContrastBorderColor ? `1px solid ${headerHighContrastBorderColor}` : null;
157163
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import { ITheme, IThemeService } from 'vs/platform/theme/common/themeService';
99
import { inputBackground, inputForeground, ColorIdentifier, selectForeground, selectBackground, selectBorder, inputBorder, foreground, editorBackground, contrastBorder, inputActiveOptionBorder, listFocusBackground, listFocusForeground, listActiveSelectionBackground, listActiveSelectionForeground, listInactiveSelectionForeground, listInactiveSelectionBackground, listHoverBackground, listHoverForeground, listDropBackground, pickerGroupBorder, pickerGroupForeground, widgetShadow, inputValidationInfoBorder, inputValidationInfoBackground, inputValidationWarningBorder, inputValidationWarningBackground, inputValidationErrorBorder, inputValidationErrorBackground, activeContrastBorder, buttonForeground, buttonBackground, buttonHoverBackground, ColorFunction, lighten, badgeBackground, badgeForeground, progressBarBackground } from 'vs/platform/theme/common/colorRegistry';
1010
import { IDisposable } from 'vs/base/common/lifecycle';
11-
import { SIDE_BAR_SECTION_HEADER_BACKGROUND } from 'vs/workbench/common/theme';
11+
import { SIDE_BAR_SECTION_HEADER_BACKGROUND, SIDE_BAR_SECTION_HEADER_FOREGROUND } from 'vs/workbench/common/theme';
1212

1313
export type styleFn = (colors: { [name: string]: ColorIdentifier }) => void;
1414

@@ -224,6 +224,7 @@ export function attachListStyler(widget: IThemable, themeService: IThemeService,
224224

225225
export function attachHeaderViewStyler(widget: IThemable, themeService: IThemeService, options?: { noContrastBorder?: boolean }): IDisposable {
226226
return doAttachStyler(themeService, {
227+
headerForeground: SIDE_BAR_SECTION_HEADER_FOREGROUND,
227228
headerBackground: SIDE_BAR_SECTION_HEADER_BACKGROUND,
228229
headerHighContrastBorder: (options && options.noContrastBorder) ? null : contrastBorder
229230
}, widget);

src/vs/workbench/common/theme.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,12 @@ export const SIDE_BAR_SECTION_HEADER_BACKGROUND = registerColor('sideBarSectionH
240240
hc: null
241241
}, nls.localize('sideBarSectionHeaderBackground', "Side bar section header background color. The side bar is the container for views like explorer and search."));
242242

243+
export const SIDE_BAR_SECTION_HEADER_FOREGROUND = registerColor('sideBarSectionHeader.foreground', {
244+
dark: SIDE_BAR_FOREGROUND,
245+
light: SIDE_BAR_FOREGROUND,
246+
hc: SIDE_BAR_FOREGROUND
247+
}, nls.localize('sideBarSectionHeaderForeground', "Side bar section header foreground color. The side bar is the container for views like explorer and search."));
248+
243249

244250

245251
// < --- Title Bar --- >

src/vs/workbench/parts/files/browser/explorerViewlet.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,11 @@ export class ExplorerViewlet extends Viewlet {
207207
const views = [];
208208

209209
const viewsState = JSON.parse(this.storageService.get(ExplorerViewlet.EXPLORER_VIEWS_STATE, this.contextService.hasWorkspace() ? StorageScope.WORKSPACE : StorageScope.GLOBAL, '{}'));
210-
for (const viewDescrirptor of viewDescriptors) {
211-
const view = this.instantiationService.createInstance(viewDescrirptor.ctor, viewDescrirptor.id, {
212-
name: viewDescrirptor.name,
210+
for (const viewDescriptor of viewDescriptors) {
211+
const view = this.instantiationService.createInstance(viewDescriptor.ctor, viewDescriptor.id, {
212+
name: viewDescriptor.name,
213213
actionRunner: this.getActionRunner(),
214-
collapsed: viewsState[viewDescrirptor.id] ? (<IViewState>viewsState[viewDescrirptor.id]).collapsed : true
214+
collapsed: viewsState[viewDescriptor.id] ? (<IViewState>viewsState[viewDescriptor.id]).collapsed : true
215215
});
216216
views.push(view);
217217
this.views.push(view);

src/vs/workbench/parts/tasks/electron-browser/task.contribution.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ import { ProcessRunnerDetector } from 'vs/workbench/parts/tasks/node/processRunn
8080

8181
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
8282

83+
import { Themable, STATUS_BAR_FOREGROUND } from 'vs/workbench/common/theme';
84+
import { IThemeService } from 'vs/platform/theme/common/themeService';
85+
8386
let $ = Builder.$;
8487
let tasksCategory = nls.localize('tasksCategory', "Tasks");
8588

@@ -1370,8 +1373,6 @@ let schema: IJSONSchema = {
13701373

13711374
import schemaVersion1 from './jsonSchema_v1';
13721375
import schemaVersion2 from './jsonSchema_v2';
1373-
import { Themable, STATUS_BAR_FOREGROUND } from 'vs/workbench/common/theme';
1374-
import { IThemeService } from 'vs/platform/theme/common/themeService';
13751376
schema.definitions = {
13761377
...schemaVersion1.definitions,
13771378
...schemaVersion2.definitions,

0 commit comments

Comments
 (0)