Set tab color default off and add config for fill/border (#452)

This commit is contained in:
Matt Irvine
2018-01-08 20:05:27 -05:00
committed by GitHub
parent 62de97da54
commit 5e4b8924ec
5 changed files with 35 additions and 15 deletions

View File

@@ -47,6 +47,9 @@ import { IWorkspacesService } from 'vs/platform/workspaces/common/workspaces';
// {{SQL CARBON EDIT}} -- Display the editor's tab color
import { Color } from 'vs/base/common/color';
import { IWorkspaceConfigurationService } from 'vs/workbench/services/configuration/common/configuration';
import * as QueryConstants from 'sql/parts/query/common/constants';
import * as WorkbenchUtils from 'sql/workbench/common/sqlWorkbenchUtils';
interface IEditorInputLabel {
name: string;
@@ -80,7 +83,9 @@ export class TabsTitleControl extends TitleControl {
@IWindowsService private windowsService: IWindowsService,
@IThemeService themeService: IThemeService,
@IFileService private fileService: IFileService,
@IWorkspacesService private workspacesService: IWorkspacesService
@IWorkspacesService private workspacesService: IWorkspacesService,
// {{SQL CARBON EDIT}} -- Display the editor's tab color
@IWorkspaceConfigurationService private workspaceConfigurationService: IWorkspaceConfigurationService
) {
super(contextMenuService, instantiationService, editorService, editorGroupService, contextKeyService, keybindingService, telemetryService, messageService, menuService, quickOpenService, themeService);
@@ -866,16 +871,20 @@ export class TabsTitleControl extends TitleControl {
// {{SQL CARBON EDIT}} -- Display the editor's tab color
private setEditorTabColor(editor: IEditorInput, tabContainer: HTMLElement, isTabActive: boolean) {
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 {
let tabColorMode = WorkbenchUtils.getSqlConfigValue<string>(this.workspaceConfigurationService, 'tabColorMode');
if (tabColorMode === QueryConstants.tabColorModeOff || (tabColorMode !== QueryConstants.tabColorModeBorder && tabColorMode !== QueryConstants.tabColorModeFill)
|| this.themeService.getTheme().type === HIGH_CONTRAST || !sqlEditor.tabColor) {
tabContainer.style.borderTopColor = '';
tabContainer.style.borderTopWidth = '';
return;
}
tabContainer.style.borderTopColor = sqlEditor.tabColor;
tabContainer.style.borderTopWidth = isTabActive ? '3px' : '2px';
if (tabColorMode === QueryConstants.tabColorModeFill) {
let backgroundColor = Color.Format.CSS.parseHex(sqlEditor.tabColor);
if (backgroundColor) {
tabContainer.style.backgroundColor = backgroundColor.transparent(isTabActive ? 0.5 : 0.2).toString();
}
}
}
}