Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
9208b8d0
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9208b8d0
编写于
3月 01, 2019
作者:
B
Benjamin Pasero
提交者:
Martin Aeschlimann
3月 18, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
allow for IStatusbarEntry#backgroundColor
上级
959300f5
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
38 addition
and
14 deletion
+38
-14
src/vs/platform/statusbar/common/statusbar.ts
src/vs/platform/statusbar/common/statusbar.ts
+5
-0
src/vs/workbench/browser/parts/statusbar/media/statusbarpart.css
...workbench/browser/parts/statusbar/media/statusbarpart.css
+6
-0
src/vs/workbench/browser/parts/statusbar/statusbarPart.ts
src/vs/workbench/browser/parts/statusbar/statusbarPart.ts
+27
-14
未找到文件。
src/vs/platform/statusbar/common/statusbar.ts
浏览文件 @
9208b8d0
...
...
@@ -36,6 +36,11 @@ export interface IStatusbarEntry {
*/
readonly
color
?:
string
|
ThemeColor
;
/**
* An optional background color to use for the entry
*/
readonly
backgroundColor
?:
string
|
ThemeColor
;
/**
* An optional id of a command that is known to the workbench to execute on click
*/
...
...
src/vs/workbench/browser/parts/statusbar/media/statusbarpart.css
浏览文件 @
9208b8d0
...
...
@@ -48,10 +48,16 @@
.monaco-workbench
.part.statusbar
>
.statusbar-item.left
:first-child
,
.monaco-workbench
.part.statusbar
>
.statusbar-item.right
+
.statusbar-item.left
{
padding-left
:
7px
;
}
.monaco-workbench
.part.statusbar
>
.statusbar-item.has-background-color.left
:first-child
,
.monaco-workbench
.part.statusbar
>
.statusbar-item.right
+
.statusbar-item.has-background-color.left
{
padding-right
:
7px
;
/* expand padding if background color is configured for the status bar entry to make it look centered properly */
}
/* adding padding to the most right status bar item */
.monaco-workbench
.part.statusbar
>
.statusbar-item.right
:first-child
{
padding-right
:
7px
;
}
.monaco-workbench
.part.statusbar
>
.statusbar-item.has-background-color.right
:first-child
{
padding-left
:
7px
;
/* expand padding if background color is configured for the status bar entry to make it look centered properly */
}
.monaco-workbench
.part.statusbar
>
.statusbar-item
a
{
cursor
:
pointer
;
...
...
src/vs/workbench/browser/parts/statusbar/statusbarPart.ts
浏览文件 @
9208b8d0
...
...
@@ -6,7 +6,7 @@
import
'
vs/css!./media/statusbarpart
'
;
import
*
as
nls
from
'
vs/nls
'
;
import
{
toErrorMessage
}
from
'
vs/base/common/errorMessage
'
;
import
{
dispose
,
IDisposable
,
toDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
dispose
,
IDisposable
,
toDisposable
,
combinedDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
OcticonLabel
}
from
'
vs/base/browser/ui/octiconLabel/octiconLabel
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
ICommandService
}
from
'
vs/platform/commands/common/commands
'
;
...
...
@@ -18,7 +18,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import
{
StatusbarAlignment
,
IStatusbarService
,
IStatusbarEntry
}
from
'
vs/platform/statusbar/common/statusbar
'
;
import
{
IContextMenuService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
Action
}
from
'
vs/base/common/actions
'
;
import
{
IThemeService
,
registerThemingParticipant
,
ITheme
,
ICssStyleCollector
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
IThemeService
,
registerThemingParticipant
,
ITheme
,
ICssStyleCollector
,
ThemeColor
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
STATUS_BAR_BACKGROUND
,
STATUS_BAR_FOREGROUND
,
STATUS_BAR_NO_FOLDER_BACKGROUND
,
STATUS_BAR_ITEM_HOVER_BACKGROUND
,
STATUS_BAR_ITEM_ACTIVE_BACKGROUND
,
STATUS_BAR_PROMINENT_ITEM_BACKGROUND
,
STATUS_BAR_PROMINENT_ITEM_HOVER_BACKGROUND
,
STATUS_BAR_BORDER
,
STATUS_BAR_NO_FOLDER_FOREGROUND
,
STATUS_BAR_NO_FOLDER_BORDER
}
from
'
vs/workbench/common/theme
'
;
import
{
IWorkspaceContextService
,
WorkbenchState
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
contrastBorder
}
from
'
vs/platform/theme/common/colorRegistry
'
;
...
...
@@ -283,18 +283,13 @@ class StatusBarEntryItem implements IStatusbarItem {
textContainer
.
title
=
this
.
entry
.
tooltip
;
}
// Color
let
color
=
this
.
entry
.
color
;
if
(
color
)
{
if
(
isThemeColor
(
color
))
{
let
colorId
=
color
.
id
;
color
=
(
this
.
themeService
.
getTheme
().
getColor
(
colorId
)
||
Color
.
transparent
).
toString
();
toDispose
.
push
(
this
.
themeService
.
onThemeChange
(
theme
=>
{
let
colorValue
=
(
this
.
themeService
.
getTheme
().
getColor
(
colorId
)
||
Color
.
transparent
).
toString
();
textContainer
.
style
.
color
=
colorValue
;
}));
}
textContainer
.
style
.
color
=
color
;
// Color (only applies to text container)
toDispose
.
push
(
this
.
applyColor
(
textContainer
,
this
.
entry
.
color
));
// Background Color (applies to parent element to fully fill container)
if
(
this
.
entry
.
backgroundColor
)
{
toDispose
.
push
(
this
.
applyColor
(
el
,
this
.
entry
.
backgroundColor
,
true
));
addClass
(
el
,
'
has-background-color
'
);
}
// Context Menu
...
...
@@ -319,6 +314,24 @@ class StatusBarEntryItem implements IStatusbarItem {
};
}
private
applyColor
(
container
:
HTMLElement
,
color
:
string
|
ThemeColor
,
isBackground
?:
boolean
):
IDisposable
{
const
disposable
:
IDisposable
[]
=
[];
if
(
color
)
{
if
(
isThemeColor
(
color
))
{
const
colorId
=
color
.
id
;
color
=
(
this
.
themeService
.
getTheme
().
getColor
(
colorId
)
||
Color
.
transparent
).
toString
();
disposable
.
push
(
this
.
themeService
.
onThemeChange
(
theme
=>
{
const
colorValue
=
(
theme
.
getColor
(
colorId
)
||
Color
.
transparent
).
toString
();
isBackground
?
container
.
style
.
backgroundColor
=
colorValue
:
container
.
style
.
color
=
colorValue
;
}));
}
isBackground
?
container
.
style
.
backgroundColor
=
color
:
container
.
style
.
color
=
color
;
}
return
combinedDisposable
(
disposable
);
}
private
executeCommand
(
id
:
string
,
args
?:
any
[])
{
args
=
args
||
[];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录