mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-07 17:23:56 -05:00
Set tab color default off and add config for fill/border (#452)
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user