Skip to content

Commit 830b94b

Browse files
author
Benjamin Pasero
committed
themes - get rid of tab.activeWithInactiveEditorGroupForeground and inactiveWithInactiveEditorGroupForeground
1 parent 6ee1fb1 commit 830b94b

6 files changed

Lines changed: 49 additions & 32 deletions

File tree

extensions/theme-abyss/themes/abyss-color-theme.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,9 +359,7 @@
359359
// "tab.activeBackground": "",
360360
"tab.inactiveBackground": "#10192c",
361361
// "tab.activeForeground": "",
362-
// "tab.activeWithInactiveEditorGroupForeground": "",
363362
// "tab.inactiveForeground": "",
364-
// "tab.inactiveWithInactiveEditorGroupForeground": "",
365363

366364
// Workbench: Activity Bar
367365
"activityBar.background": "#051336",

extensions/theme-solarized-dark/themes/solarized-dark-color-theme.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,6 @@
398398
"tab.inactiveBackground": "#004052",
399399
"editorGroupHeader.tabsBackground": "#004052",
400400
"tab.border": "#003847",
401-
"tab.activeWithInactiveEditorGroupForeground": "#93A1A1",
402-
"tab.inactiveWithInactiveEditorGroupForeground": "#93A1A1",
403401

404402
// Workbench: Activity Bar
405403
"activityBar.background": "#003847",

extensions/theme-solarized-light/themes/solarized-light-color-theme.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,6 @@
321321
"tab.inactiveBackground": "#CCC4B0",
322322
"editorGroupHeader.tabsBackground": "#CCC4B0",
323323
"tab.border": "#DDD6C1",
324-
// "tab.activeWithInactiveEditorGroupForeground": "#586E75",
325-
// "tab.inactiveWithInactiveEditorGroupForeground": "#586E75",
326324
"debugToolBar.background": "#EEE8D5",
327325
"dropdown.background": "#EEE8D5",
328326
"dropdown.border": "#2AA19899",

src/vs/workbench/browser/parts/editor/noTabsTitleControl.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import DOM = require('vs/base/browser/dom');
1212
import { TitleControl } from 'vs/workbench/browser/parts/editor/titleControl';
1313
import { EditorLabel } from 'vs/workbench/browser/labels';
1414
import { Verbosity } from 'vs/platform/editor/common/editor';
15-
import { TAB_ACTIVE_GROUP_INACTIVE_FOREGROUND, TAB_ACTIVE_GROUP_ACTIVE_FOREGROUND } from 'vs/workbench/common/theme';
15+
import { TAB_ACTIVE_FOREGROUND } from 'vs/workbench/common/theme';
1616

1717
export class NoTabsTitleControl extends TitleControl {
1818
private titleContainer: HTMLElement;
@@ -126,11 +126,19 @@ export class NoTabsTitleControl extends TitleControl {
126126
}
127127

128128
this.editorLabel.setLabel({ name, description, resource }, { title, italic: !isPinned, extraClasses: ['title-label'] });
129-
if (isActive) {
130-
this.editorLabel.element.style.color = this.getColor(TAB_ACTIVE_GROUP_ACTIVE_FOREGROUND);
131-
} else {
132-
this.editorLabel.element.style.color = this.getColor(TAB_ACTIVE_GROUP_INACTIVE_FOREGROUND);
133-
}
129+
this.editorLabel.element.style.color = this.getColor(TAB_ACTIVE_FOREGROUND, (color, theme) => {
130+
if (!isActive) {
131+
if (theme.type === 'dark') {
132+
return color.transparent(0.5);
133+
}
134+
135+
if (theme.type === 'light') {
136+
return color.transparent(0.7);
137+
}
138+
}
139+
140+
return color;
141+
});
134142

135143
// Update Editor Actions Toolbar
136144
this.updateEditorActionsToolbar();

src/vs/workbench/browser/parts/editor/tabsTitleControl.ts

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import { LinkedMap } from 'vs/base/common/map';
4040
import { DelegatingWorkbenchEditorService } from 'vs/workbench/services/editor/browser/editorService';
4141
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
4242
import { IThemeService, registerThemingParticipant, ITheme, ICssStyleCollector } from 'vs/platform/theme/common/themeService';
43-
import { TAB_INACTIVE_BACKGROUND, TAB_ACTIVE_BACKGROUND, TAB_ACTIVE_GROUP_ACTIVE_FOREGROUND, TAB_ACTIVE_GROUP_INACTIVE_FOREGROUND, TAB_INACTIVE_GROUP_ACTIVE_FOREGROUND, TAB_INACTIVE_GROUP_INACTIVE_FOREGROUND, TAB_BORDER, EDITOR_DRAG_AND_DROP_BACKGROUND } from 'vs/workbench/common/theme';
43+
import { TAB_INACTIVE_BACKGROUND, TAB_ACTIVE_BACKGROUND, TAB_ACTIVE_FOREGROUND, TAB_INACTIVE_FOREGROUND, TAB_BORDER, EDITOR_DRAG_AND_DROP_BACKGROUND } from 'vs/workbench/common/theme';
4444
import { activeContrastBorder, contrastBorder } from 'vs/platform/theme/common/colorRegistry';
4545

4646
interface IEditorInputLabel {
@@ -291,14 +291,38 @@ export class TabsTitleControl extends TitleControl {
291291
DOM.addClass(tabContainer, 'active');
292292
tabContainer.setAttribute('aria-selected', 'true');
293293
tabContainer.style.backgroundColor = this.getColor(TAB_ACTIVE_BACKGROUND);
294-
tabLabel.element.style.color = this.getColor(isGroupActive ? TAB_ACTIVE_GROUP_ACTIVE_FOREGROUND : TAB_ACTIVE_GROUP_INACTIVE_FOREGROUND);
294+
tabLabel.element.style.color = this.getColor(TAB_ACTIVE_FOREGROUND, (color, theme) => {
295+
if (!isGroupActive) {
296+
if (theme.type === 'dark') {
297+
return color.transparent(0.5);
298+
}
299+
300+
if (theme.type === 'light') {
301+
return color.transparent(0.7);
302+
}
303+
}
304+
305+
return color;
306+
});
295307

296308
this.activeTab = tabContainer;
297309
} else {
298310
DOM.removeClass(tabContainer, 'active');
299311
tabContainer.setAttribute('aria-selected', 'false');
300312
tabContainer.style.backgroundColor = this.getColor(TAB_INACTIVE_BACKGROUND);
301-
tabLabel.element.style.color = this.getColor(isGroupActive ? TAB_INACTIVE_GROUP_ACTIVE_FOREGROUND : TAB_INACTIVE_GROUP_INACTIVE_FOREGROUND);
313+
tabLabel.element.style.color = this.getColor(TAB_INACTIVE_FOREGROUND, (color, theme) => {
314+
if (!isGroupActive) {
315+
if (theme.type === 'dark') {
316+
return color.transparent(0.5).transparent(0.5);
317+
}
318+
319+
if (theme.type === 'light') {
320+
return color.transparent(0.7).transparent(0.5);
321+
}
322+
}
323+
324+
return color;
325+
});
302326
}
303327

304328
// Dirty State

src/vs/workbench/common/theme.ts

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,31 +35,18 @@ export const TAB_BORDER = registerColor('tab.border', {
3535
hc: contrastBorder
3636
}, nls.localize('tabBorder', "Border to separate tabs from each other. Tabs are the containers for editors in the editor area. Multiple tabs can be opened in one editor group. There can be multiple editor groups."));
3737

38-
export const TAB_ACTIVE_GROUP_ACTIVE_FOREGROUND = registerColor('tab.activeForeground', {
38+
export const TAB_ACTIVE_FOREGROUND = registerColor('tab.activeForeground', {
3939
dark: Color.white,
4040
light: Color.fromRGBA(new RGBA(51, 51, 51)),
4141
hc: Color.white
4242
}, nls.localize('tabActiveEditorGroupActiveForeground', "Active tab foreground color in an active group. Tabs are the containers for editors in the editor area. Multiple tabs can be opened in one editor group. There can be multiple editor groups."));
4343

44-
export const TAB_ACTIVE_GROUP_INACTIVE_FOREGROUND = registerColor('tab.activeWithInactiveEditorGroupForeground', {
45-
dark: Color.white.transparent(0.5),
46-
light: Color.fromRGBA(new RGBA(51, 51, 51)).transparent(0.7),
47-
hc: Color.white
48-
}, nls.localize('tabActiveEditorGroupInactiveForeground', "Active tab foreground color in an inactive group. Tabs are the containers for editors in the editor area. Multiple tabs can be opened in one editor group. There can be multiple editor groups."));
49-
50-
export const TAB_INACTIVE_GROUP_ACTIVE_FOREGROUND = registerColor('tab.inactiveForeground', {
44+
export const TAB_INACTIVE_FOREGROUND = registerColor('tab.inactiveForeground', {
5145
dark: Color.white.transparent(0.5),
5246
light: Color.fromRGBA(new RGBA(51, 51, 51)).transparent(0.5),
5347
hc: Color.white
5448
}, nls.localize('tabInactiveEditorGroupActiveForeground', "Inactive tab foreground color in an active group. Tabs are the containers for editors in the editor area. Multiple tabs can be opened in one editor group. There can be multiple editor groups."));
5549

56-
export const TAB_INACTIVE_GROUP_INACTIVE_FOREGROUND = registerColor('tab.inactiveWithInactiveEditorGroupForeground', {
57-
dark: Color.fromRGBA(new RGBA(255, 255, 255)).transparent(0.5).transparent(0.5),
58-
light: Color.fromRGBA(new RGBA(51, 51, 51)).transparent(0.5).transparent(0.7),
59-
hc: Color.white
60-
}, nls.localize('tabInactiveEditorGroupInactiveForeground', "Inactive tab foreground color in an inactive group. Tabs are the containers for editors in the editor area. Multiple tabs can be opened in one editor group. There can be multiple editor groups."));
61-
62-
6350

6451
// < --- Editors --- >
6552

@@ -298,8 +285,12 @@ export class Themable extends Disposable {
298285
// Subclasses to override
299286
}
300287

301-
protected getColor(id: string): string {
302-
const color = this.theme.getColor(id);
288+
protected getColor(id: string, modify?: (color: Color, theme: ITheme) => Color): string {
289+
let color = this.theme.getColor(id);
290+
291+
if (color && modify) {
292+
color = modify(color, this.theme);
293+
}
303294

304295
return color ? color.toString() : null;
305296
}

0 commit comments

Comments
 (0)