提交 8e574096 编写于 作者: M Miguel Solorio

Add color tokens for active activity bar elements

上级 ab0eb6de
......@@ -22,7 +22,7 @@ import { ActivityAction, ActivityActionViewItem, ICompositeBar, ICompositeBarCol
import { ViewletDescriptor } from 'vs/workbench/browser/viewlet';
import { Extensions as ActionExtensions, IWorkbenchActionRegistry } from 'vs/workbench/common/actions';
import { IActivity } from 'vs/workbench/common/activity';
import { ACTIVITY_BAR_FOREGROUND } from 'vs/workbench/common/theme';
import { ACTIVITY_BAR_FOREGROUND, ACTIVITY_BAR_ACTIVE_BORDER, ACTIVITY_BAR_ACTIVE_BACKGROUND } from 'vs/workbench/common/theme';
import { IActivityBarService } from 'vs/workbench/services/activityBar/browser/activityBarService';
import { IWorkbenchLayoutService, Parts } from 'vs/workbench/services/layout/browser/layoutService';
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
......@@ -278,6 +278,42 @@ registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => {
`);
}
const activeBorderColor = theme.getColor(ACTIVITY_BAR_ACTIVE_BORDER);
if (activeBorderColor) {
collector.addRule(`
.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item.checked:before {
content: "";
position: absolute;
z-index: 1;
top: 0;
bottom: 0;
margin: auto;
left: 0;
width: 100%;
height: calc(100% - 10px);
margin-left: 1px;
border-left: 2px solid ${activeBorderColor};
}
`);
}
const activeBackgroundColor = theme.getColor(ACTIVITY_BAR_ACTIVE_BACKGROUND);
if (activeForegroundColor) {
collector.addRule(`
.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item.checked:after {
content: "";
position: absolute;
top: 0;
bottom: 0;
margin: auto;
width: 100%;
height: calc(100% - 10px);
margin-left: 1px;
background-color: ${activeBackgroundColor};
}
`);
}
// Styling with Outline color (e.g. high contrast theme)
const outline = theme.getColor(activeContrastBorder);
if (outline) {
......@@ -285,9 +321,11 @@ registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => {
.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item:before {
content: "";
position: absolute;
top: 9px;
left: 9px;
height: 32px;
top: 0;
bottom: 0;
left: 0;
margin: auto;
height: calc(100% - 10px);
width: 32px;
}
......
......@@ -18,7 +18,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { IDisposable, toDisposable, DisposableStore } from 'vs/base/common/lifecycle';
import { ToggleActivityBarVisibilityAction } from 'vs/workbench/browser/actions/layoutActions';
import { IThemeService, ITheme } from 'vs/platform/theme/common/themeService';
import { ACTIVITY_BAR_BACKGROUND, ACTIVITY_BAR_BORDER, ACTIVITY_BAR_FOREGROUND, ACTIVITY_BAR_BADGE_BACKGROUND, ACTIVITY_BAR_BADGE_FOREGROUND, ACTIVITY_BAR_DRAG_AND_DROP_BACKGROUND, ACTIVITY_BAR_INACTIVE_FOREGROUND } from 'vs/workbench/common/theme';
import { ACTIVITY_BAR_BACKGROUND, ACTIVITY_BAR_BORDER, ACTIVITY_BAR_FOREGROUND, ACTIVITY_BAR_ACTIVE_BORDER, ACTIVITY_BAR_BADGE_BACKGROUND, ACTIVITY_BAR_BADGE_FOREGROUND, ACTIVITY_BAR_DRAG_AND_DROP_BACKGROUND, ACTIVITY_BAR_INACTIVE_FOREGROUND, ACTIVITY_BAR_ACTIVE_BACKGROUND } from 'vs/workbench/common/theme';
import { contrastBorder } from 'vs/platform/theme/common/colorRegistry';
import { CompositeBar, ICompositeBarItem } from 'vs/workbench/browser/parts/compositeBar';
import { Dimension, addClass, removeNode } from 'vs/base/browser/dom';
......@@ -275,6 +275,8 @@ export class ActivitybarPart extends Part implements IActivityBarService {
return {
activeForegroundColor: theme.getColor(ACTIVITY_BAR_FOREGROUND),
inactiveForegroundColor: theme.getColor(ACTIVITY_BAR_INACTIVE_FOREGROUND),
activeBorderColor: theme.getColor(ACTIVITY_BAR_ACTIVE_BORDER),
activeBackground: theme.getColor(ACTIVITY_BAR_ACTIVE_BACKGROUND),
badgeBackground: theme.getColor(ACTIVITY_BAR_BADGE_BACKGROUND),
badgeForeground: theme.getColor(ACTIVITY_BAR_BADGE_FOREGROUND),
dragAndDropBackground: theme.getColor(ACTIVITY_BAR_DRAG_AND_DROP_BACKGROUND),
......
......@@ -10,6 +10,8 @@
}
.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-label {
position: relative;
z-index: 1;
display: flex;
overflow: hidden;
height: 40px;
......@@ -23,8 +25,11 @@
.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item:focus:before {
content: "";
position: absolute;
top: 9px;
height: 32px;
top: 0;
bottom: 0;
left: 0;
margin: auto;
height: calc(100% - 10px);
width: 0;
border-left: 2px solid;
}
......
......@@ -110,6 +110,8 @@ export class ActivityAction extends Action {
export interface ICompositeBarColors {
activeBackgroundColor?: Color;
inactiveBackgroundColor?: Color;
activeBorderColor?: Color;
activeBackground?: Color;
activeBorderBottomColor?: Color;
activeForegroundColor?: Color;
inactiveForegroundColor?: Color;
......
......@@ -335,8 +335,8 @@ export const ACTIVITY_BAR_FOREGROUND = registerColor('activityBar.foreground', {
}, nls.localize('activityBarForeground', "Activity bar item foreground color when it is active. The activity bar is showing on the far left or right and allows to switch between views of the side bar."));
export const ACTIVITY_BAR_INACTIVE_FOREGROUND = registerColor('activityBar.inactiveForeground', {
dark: transparent(ACTIVITY_BAR_FOREGROUND, 0.6),
light: transparent(ACTIVITY_BAR_FOREGROUND, 0.6),
dark: transparent(ACTIVITY_BAR_FOREGROUND, 0.4),
light: transparent(ACTIVITY_BAR_FOREGROUND, 0.4),
hc: Color.white
}, nls.localize('activityBarInActiveForeground', "Activity bar item foreground color when it is inactive. The activity bar is showing on the far left or right and allows to switch between views of the side bar."));
......@@ -346,6 +346,18 @@ export const ACTIVITY_BAR_BORDER = registerColor('activityBar.border', {
hc: contrastBorder
}, nls.localize('activityBarBorder', "Activity bar border color separating to the side bar. The activity bar is showing on the far left or right and allows to switch between views of the side bar."));
export const ACTIVITY_BAR_ACTIVE_BORDER = registerColor('activityBar.activeBorder', {
dark: ACTIVITY_BAR_FOREGROUND,
light: ACTIVITY_BAR_FOREGROUND,
hc: ACTIVITY_BAR_FOREGROUND
}, nls.localize('activityBarActiveBorder', "Activity bar border for active items. The activity bar is showing on the far left or right and allows to switch between views of the side bar."));
export const ACTIVITY_BAR_ACTIVE_BACKGROUND = registerColor('activityBar.activeBackground', {
dark: transparent(ACTIVITY_BAR_FOREGROUND, 0.1),
light: transparent(ACTIVITY_BAR_FOREGROUND, 0.1),
hc: null
}, nls.localize('activityBarActiveBorder', "Activity bar border for active items. The activity bar is showing on the far left or right and allows to switch between views of the side bar."));
export const ACTIVITY_BAR_DRAG_AND_DROP_BACKGROUND = registerColor('activityBar.dropBackground', {
dark: Color.white.transparent(0.12),
light: Color.white.transparent(0.12),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册