提交 68e0c759 编写于 作者: B Benjamin Pasero

theming - always allow high contrast outline and border color even when not in hc theme

上级 dbe9e9c2
......@@ -149,7 +149,6 @@ export class ActivityActionItem extends BaseActionItem {
private updateStyles(): void {
const theme = this.themeService.getTheme();
const isHighContrastTheme = theme.type === 'hc';
// Label
if (this.$e) {
......@@ -167,9 +166,9 @@ export class ActivityActionItem extends BaseActionItem {
this.$badgeContent.style('color', badgeForeground ? badgeForeground.toString() : null);
this.$badgeContent.style('background-color', badgeBackground ? badgeBackground.toString() : null);
this.$badgeContent.style('border-style', isHighContrastTheme ? 'solid' : null);
this.$badgeContent.style('border-width', isHighContrastTheme ? '1px' : null);
this.$badgeContent.style('border-color', isHighContrastTheme && hcBorder ? hcBorder.toString() : null);
this.$badgeContent.style('border-style', hcBorder ? 'solid' : null);
this.$badgeContent.style('border-width', hcBorder ? '1px' : null);
this.$badgeContent.style('border-color', hcBorder ? hcBorder.toString() : null);
}
}
......
......@@ -222,15 +222,15 @@ export class ActivitybarPart extends Part implements IActivityBarService {
const background = this.getColor(ACTIVITY_BAR_BACKGROUND);
container.style('background-color', background);
const useBorder = this.isHighContrastTheme;
const hcBorder = this.getColor(highContrastBorder);
const isPositionLeft = this.partService.getSideBarPosition() === SideBarPosition.LEFT;
container.style('box-sizing', useBorder && isPositionLeft ? 'border-box' : null);
container.style('border-right-width', useBorder && isPositionLeft ? '1px' : null);
container.style('border-right-style', useBorder && isPositionLeft ? 'solid' : null);
container.style('border-right-color', useBorder && isPositionLeft ? this.getColor(highContrastBorder) : null);
container.style('border-left-width', useBorder && !isPositionLeft ? '1px' : null);
container.style('border-left-style', useBorder && !isPositionLeft ? 'solid' : null);
container.style('border-left-color', useBorder && !isPositionLeft ? this.getColor(highContrastBorder) : null);
container.style('box-sizing', hcBorder && isPositionLeft ? 'border-box' : null);
container.style('border-right-width', hcBorder && isPositionLeft ? '1px' : null);
container.style('border-right-style', hcBorder && isPositionLeft ? 'solid' : null);
container.style('border-right-color', isPositionLeft ? hcBorder : null);
container.style('border-left-width', hcBorder && !isPositionLeft ? '1px' : null);
container.style('border-left-style', hcBorder && !isPositionLeft ? 'solid' : null);
container.style('border-left-color', !isPositionLeft ? hcBorder : null);
}
private showContextMenu(e: MouseEvent): void {
......
......@@ -1016,11 +1016,12 @@ export class EditorGroupsControl extends Themable implements IEditorGroupsContro
// Title control
POSITIONS.forEach(position => {
const container = this.getTitleAreaControl(position).getContainer();
const hcBorder = this.getColor(highContrastBorder);
container.style.backgroundColor = this.getColor(this.tabOptions.showTabs ? TABS_CONTAINER_BACKGROUND : EDITOR_HEADER_BACKGROUND);
container.style.borderBottomWidth = (this.isHighContrastTheme && this.tabOptions.showTabs) ? '1px' : null;
container.style.borderBottomStyle = (this.isHighContrastTheme && this.tabOptions.showTabs) ? 'solid' : null;
container.style.borderBottomColor = (this.isHighContrastTheme && this.tabOptions.showTabs) ? this.getColor(highContrastBorder) : null;
container.style.borderBottomWidth = (hcBorder && this.tabOptions.showTabs) ? '1px' : null;
container.style.borderBottomStyle = (hcBorder && this.tabOptions.showTabs) ? 'solid' : null;
container.style.borderBottomColor = this.tabOptions.showTabs ? hcBorder : null;
});
}
......@@ -1225,15 +1226,15 @@ export class EditorGroupsControl extends Themable implements IEditorGroupsContro
const containers = $this.visibleEditors.filter(e => !!e).map(e => e.getContainer());
containers.forEach((container, index) => {
if (container && DOM.isAncestor(target, container.getHTMLElement())) {
const useOutline = $this.isHighContrastTheme;
const hcOutline = $this.getColor(highContrastOutline);
overlay = $('div').style({
top: $this.tabOptions.showTabs ? `${EditorGroupsControl.EDITOR_TITLE_HEIGHT}px` : 0,
height: $this.tabOptions.showTabs ? `calc(100% - ${EditorGroupsControl.EDITOR_TITLE_HEIGHT}px` : '100%',
backgroundColor: $this.getColor(EDITOR_DRAG_AND_DROP_BACKGROUND),
outlineColor: useOutline ? $this.getColor(highContrastOutline) : null,
outlineOffset: useOutline ? '-2px' : null,
outlineStyle: useOutline ? 'dashed' : null,
outlineWidth: useOutline ? '2px' : null
outlineColor: hcOutline,
outlineOffset: hcOutline ? '-2px' : null,
outlineStyle: hcOutline ? 'dashed' : null,
outlineWidth: hcOutline ? '2px' : null
}).id(overlayId);
overlay.appendTo(container);
......@@ -1568,11 +1569,11 @@ export class EditorGroupsControl extends Themable implements IEditorGroupsContro
const background = this.getColor(isDropping ? EDITOR_DRAG_AND_DROP_BACKGROUND : groupCount > 0 ? EDITOR_GROUP_BACKGROUND : null);
element.style.backgroundColor = background;
const useOutline = this.isHighContrastTheme && isDropping;
element.style.outlineColor = useOutline ? this.getColor(highContrastOutline) : null;
element.style.outlineStyle = useOutline ? 'dashed' : null;
element.style.outlineWidth = useOutline ? '2px' : null;
element.style.outlineOffset = useOutline ? '-2px' : null;
const hcOutline = this.getColor(highContrastOutline);
element.style.outlineColor = isDropping ? hcOutline : null;
element.style.outlineStyle = isDropping && hcOutline ? 'dashed' : null;
element.style.outlineWidth = isDropping && hcOutline ? '2px' : null;
element.style.outlineOffset = isDropping && hcOutline ? '-2px' : null;
}
private posSilo(pos: number, leftTop: string | number, rightBottom?: string | number, borderLeftTopWidth?: string | number): void {
......
......@@ -219,15 +219,16 @@ export class TabsTitleControl extends TitleControl {
element.style.backgroundColor = isDND ? this.getColor(EDITOR_DRAG_AND_DROP_BACKGROUND) : noDNDBackgroundColor;
// Outline
if (this.isHighContrastTheme && isDND) {
const hcOutline = this.getColor(highContrastOutline);
if (hcOutline && isDND) {
element.style.outlineWidth = '2px';
element.style.outlineStyle = 'dashed';
element.style.outlineColor = this.getColor(highContrastOutline);
element.style.outlineColor = hcOutline;
element.style.outlineOffset = isTab ? '-5px' : '-3px';
} else {
element.style.outlineWidth = null;
element.style.outlineStyle = null;
element.style.outlineColor = this.isHighContrastTheme ? this.getColor(highContrastOutline) : null;
element.style.outlineColor = hcOutline;
element.style.outlineOffset = null;
}
}
......@@ -273,7 +274,7 @@ export class TabsTitleControl extends TitleControl {
tabContainer.title = title;
tabContainer.style.borderLeftColor = (index !== 0) ? this.getColor(TAB_BORDER) : null;
tabContainer.style.borderRightColor = (index === editorsOfGroup.length - 1) ? this.getColor(TAB_BORDER) : null;
tabContainer.style.outlineColor = this.isHighContrastTheme ? this.getColor(highContrastOutline) : null;
tabContainer.style.outlineColor = this.getColor(highContrastOutline);
const tabOptions = this.editorGroupService.getTabOptions();
['off', 'left'].forEach(option => {
......
......@@ -83,14 +83,14 @@ export class SidebarPart extends CompositePart<Viewlet> {
container.style('background-color', this.getColor(SIDE_BAR_BACKGROUND));
const useBorder = this.isHighContrastTheme;
const hcBorder = this.getColor(highContrastBorder);
const isPositionLeft = this.partService.getSideBarPosition() === SideBarPosition.LEFT;
container.style('border-right-width', useBorder && isPositionLeft ? '1px' : null);
container.style('border-right-style', useBorder && isPositionLeft ? 'solid' : null);
container.style('border-right-color', useBorder && isPositionLeft ? this.getColor(highContrastBorder) : null);
container.style('border-left-width', useBorder && !isPositionLeft ? '1px' : null);
container.style('border-left-style', useBorder && !isPositionLeft ? 'solid' : null);
container.style('border-left-color', useBorder && !isPositionLeft ? this.getColor(highContrastBorder) : null);
container.style('border-right-width', hcBorder && isPositionLeft ? '1px' : null);
container.style('border-right-style', hcBorder && isPositionLeft ? 'solid' : null);
container.style('border-right-color', isPositionLeft ? hcBorder : null);
container.style('border-left-width', hcBorder && !isPositionLeft ? '1px' : null);
container.style('border-left-style', hcBorder && !isPositionLeft ? 'solid' : null);
container.style('border-left-color', !isPositionLeft ? hcBorder : null);
}
public openViewlet(id: string, focus?: boolean): TPromise<Viewlet> {
......
......@@ -139,10 +139,10 @@ export class StatusbarPart extends Part implements IStatusbarService {
container.style('color', this.getColor(STATUS_BAR_FOREGROUND));
container.style('background-color', this.getColor(this.contextService.hasWorkspace() ? STATUS_BAR_BACKGROUND : STATUS_BAR_NO_FOLDER_BACKGROUND));
const useBorder = this.isHighContrastTheme;
container.style('border-top-width', useBorder ? '1px' : null);
container.style('border-top-style', useBorder ? 'solid' : null);
container.style('border-top-color', useBorder ? this.getColor(highContrastBorder) : null);
const hcBorder = this.getColor(highContrastBorder);
container.style('border-top-width', hcBorder ? '1px' : null);
container.style('border-top-style', hcBorder ? 'solid' : null);
container.style('border-top-color', hcBorder);
}
private doCreateStatusItem(alignment: StatusbarAlignment, priority: number = 0): HTMLElement {
......
......@@ -301,14 +301,6 @@ export class Themable extends Disposable {
this._toUnbind.push(this.themeService.onThemeChange(theme => this.onThemeChange(theme)));
}
protected get isHighContrastTheme(): boolean {
return this.theme.type === 'hc';
}
protected get isLightTheme(): boolean {
return this.theme.type === 'light';
}
protected get toUnbind() {
return this._toUnbind;
}
......
......@@ -134,17 +134,17 @@ export class ElectronWindow extends Themable {
// Find out if folders are dragged and show the appropiate feedback then
this.includesFolder(draggedExternalResources).done(includesFolder => {
if (includesFolder) {
const useOutline = this.isHighContrastTheme;
const hcOutline = this.getColor(highContrastOutline);
dropOverlay = $(window.document.getElementById(this.partService.getWorkbenchElementId()))
.div({
id: 'monaco-workbench-drop-overlay'
})
.style({
backgroundColor: this.getColor(EDITOR_DRAG_AND_DROP_BACKGROUND),
outlineColor: useOutline ? this.getColor(highContrastOutline) : null,
outlineOffset: useOutline ? '-2px' : null,
outlineStyle: useOutline ? 'dashed' : null,
outlineWidth: useOutline ? '2px' : null
outlineColor: hcOutline,
outlineOffset: hcOutline ? '-2px' : null,
outlineStyle: hcOutline ? 'dashed' : null,
outlineWidth: hcOutline ? '2px' : null
})
.on(DOM.EventType.DROP, (e: DragEvent) => {
DOM.EventHelper.stop(e, true);
......
......@@ -145,9 +145,11 @@ export class DebugActionsWidget extends Themable implements IWorkbenchContributi
if (this.$el) {
this.$el.style('background-color', this.getColor(debugToolBarBackground));
this.$el.style('border-style', this.isHighContrastTheme ? 'solid' : null);
this.$el.style('border-width', this.isHighContrastTheme ? '1px' : null);
this.$el.style('border-color', this.isHighContrastTheme ? this.getColor(highContrastBorder) : null);
const hcBorder = this.getColor(highContrastBorder);
this.$el.style('border-style', hcBorder ? 'solid' : null);
this.$el.style('border-width', hcBorder ? '1px' : null);
this.$el.style('border-color', hcBorder);
}
}
......
......@@ -146,7 +146,7 @@ export class ExtensionsViewlet extends Viewlet implements IExtensionsViewlet {
public updateStyles(): void {
super.updateStyles();
const hcBorder = this.isHighContrastTheme ? this.getColor(highContrastBorder) : null;
const hcBorder = this.getColor(highContrastBorder);
this.searchBox.style.backgroundColor = this.getColor(inputBackground);
this.searchBox.style.color = this.getColor(inputForeground);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册