Add tab coloring by server group (#383)

This commit is contained in:
Matt Irvine
2017-12-20 18:21:48 -08:00
committed by GitHub
parent 3ffafbe5bc
commit b1b3a92717
14 changed files with 152 additions and 8 deletions

View File

@@ -87,6 +87,8 @@ export interface IEditorGroupsControl {
getRatio(): number[];
// {{SQL CARBON EDIT}} -- Allow editor titles to be refreshed to support tab coloring
refreshTitles(): void;
dispose(): void;
}
@@ -2126,6 +2128,14 @@ export class EditorGroupsControl extends Themable implements IEditorGroupsContro
}
}
// {{SQL CARBON EDIT}} -- Allow editor titles to be refreshed to support tab coloring
public refreshTitles(): void {
POSITIONS.forEach(position => {
let titleControl = this.getTitleAreaControl(position);
titleControl.refresh();
});
}
public dispose(): void {
super.dispose();

View File

@@ -1359,6 +1359,11 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
return sizes;
}
// {{SQL CARBON EDIT}} -- Allow editor titles to be refreshed to support tab coloring
public refreshEditorTitles(): void {
this.editorGroupsControl.refreshTitles();
}
public shutdown(): void {
// Persist UI State

View File

@@ -39,12 +39,15 @@ import { ScrollbarVisibility } from 'vs/base/common/scrollable';
import { extractResources } from 'vs/base/browser/dnd';
import { getOrSet } from 'vs/base/common/map';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { IThemeService, registerThemingParticipant, ITheme, ICssStyleCollector } from 'vs/platform/theme/common/themeService';
import { IThemeService, registerThemingParticipant, ITheme, ICssStyleCollector, HIGH_CONTRAST } from 'vs/platform/theme/common/themeService';
import { TAB_INACTIVE_BACKGROUND, TAB_ACTIVE_BACKGROUND, TAB_ACTIVE_FOREGROUND, TAB_INACTIVE_FOREGROUND, TAB_BORDER, EDITOR_DRAG_AND_DROP_BACKGROUND, TAB_UNFOCUSED_ACTIVE_FOREGROUND, TAB_UNFOCUSED_INACTIVE_FOREGROUND, TAB_UNFOCUSED_ACTIVE_BORDER, TAB_ACTIVE_BORDER } from 'vs/workbench/common/theme';
import { activeContrastBorder, contrastBorder } from 'vs/platform/theme/common/colorRegistry';
import { IFileService } from 'vs/platform/files/common/files';
import { IWorkspacesService } from 'vs/platform/workspaces/common/workspaces';
// {{SQL CARBON EDIT}} -- Display the editor's tab color
import { Color } from 'vs/base/common/color';
interface IEditorInputLabel {
name: string;
description?: string;
@@ -330,6 +333,20 @@ export class TabsTitleControl extends TitleControl {
} else {
DOM.removeClass(tabContainer, 'dirty');
}
// {{SQL CARBON EDIT}} -- Display the editor's tab color
let sqlEditor = editor as any;
if (sqlEditor.tabColor && this.themeService.getTheme().type !== HIGH_CONTRAST) {
tabContainer.style.borderTopColor = sqlEditor.tabColor;
tabContainer.style.borderTopWidth = isTabActive ? '2px' : '1px';
let backgroundColor = Color.Format.CSS.parseHex(sqlEditor.tabColor);
if (backgroundColor) {
tabContainer.style.backgroundColor = backgroundColor.transparent(isTabActive ? 0.3 : 0.2).toString();
}
} else {
tabContainer.style.borderTopColor = '';
tabContainer.style.borderTopWidth = '';
}
}
});