Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
87e691c9
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,发现更多精彩内容 >>
提交
87e691c9
编写于
6月 13, 2017
作者:
H
Hasan Ali
提交者:
Benjamin Pasero
6月 13, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add options to theme notification buttons and badges (#28471)
上级
03bb0adf
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
75 addition
and
10 deletion
+75
-10
src/vs/workbench/common/theme.ts
src/vs/workbench/common/theme.ts
+55
-1
src/vs/workbench/services/message/browser/messageList.ts
src/vs/workbench/services/message/browser/messageList.ts
+20
-9
未找到文件。
src/vs/workbench/common/theme.ts
浏览文件 @
87e691c9
...
...
@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import
nls
=
require
(
'
vs/nls
'
);
import
{
registerColor
,
editorBackground
,
contrastBorder
,
transparent
,
badgeForeground
,
badgeBackground
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
registerColor
,
editorBackground
,
contrastBorder
,
transparent
,
badgeForeground
,
badgeBackground
,
lighten
,
darken
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
IDisposable
,
Disposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
IThemeService
,
ITheme
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
Color
}
from
'
vs/base/common/color
'
;
...
...
@@ -306,6 +306,60 @@ export const NOTIFICATIONS_BACKGROUND = registerColor('notification.background',
hc
:
'
#000000
'
},
nls
.
localize
(
'
notificationsBackground
'
,
"
Notifications background color. Notifications slide in from the top of the window.
"
));
export
const
NOTIFICATIONS_BUTTON_BACKGROUND
=
registerColor
(
'
notification.buttonBackground
'
,
{
dark
:
'
#0E639C
'
,
light
:
'
#007ACC
'
,
hc
:
null
},
nls
.
localize
(
'
notificationsButtonBackground
'
,
"
Notifications button background color. Notifications slide in from the top of the window.
"
));
export
const
NOTIFICATIONS_BUTTON_HOVER_BACKGROUND
=
registerColor
(
'
notification.buttonHoverBackground
'
,
{
dark
:
lighten
(
NOTIFICATIONS_BUTTON_BACKGROUND
,
0.2
),
light
:
darken
(
NOTIFICATIONS_BUTTON_BACKGROUND
,
0.2
),
hc
:
null
},
nls
.
localize
(
'
notificationsButtonHoverBackground
'
,
"
Notifications button background color when hovering. Notifications slide in from the top of the window.
"
));
export
const
NOTIFICATIONS_BUTTON_FOREGROUND
=
registerColor
(
'
notification.buttonForeground
'
,
{
dark
:
Color
.
white
,
light
:
Color
.
white
,
hc
:
Color
.
white
},
nls
.
localize
(
'
notificationsButtonForeground
'
,
"
Notifications button foreground color. Notifications slide in from the top of the window.
"
));
export
const
NOTIFICATIONS_INFO_BACKGROUND
=
registerColor
(
'
notification.infoBackground
'
,
{
dark
:
'
#007acc
'
,
light
:
'
#007acc
'
,
hc
:
contrastBorder
},
nls
.
localize
(
'
notificationsInfoBackground
'
,
"
Notifications info background color. Notifications slide in from the top of the window.
"
));
export
const
NOTIFICATIONS_INFO_FOREGROUND
=
registerColor
(
'
notification.infoForeground
'
,
{
dark
:
NOTIFICATIONS_FOREGROUND
,
light
:
NOTIFICATIONS_FOREGROUND
,
hc
:
null
},
nls
.
localize
(
'
notificationsInfoForeground
'
,
"
Notifications info foreground color. Notifications slide in from the top of the window.
"
));
export
const
NOTIFICATIONS_WARNING_BACKGROUND
=
registerColor
(
'
notification.warningBackground
'
,
{
dark
:
'
#B89500
'
,
light
:
'
#B89500
'
,
hc
:
contrastBorder
},
nls
.
localize
(
'
notificationsWarningBackground
'
,
"
Notifications warning background color. Notifications slide in from the top of the window.
"
));
export
const
NOTIFICATIONS_WARNING_FOREGROUND
=
registerColor
(
'
notification.warningForeground
'
,
{
dark
:
NOTIFICATIONS_FOREGROUND
,
light
:
NOTIFICATIONS_FOREGROUND
,
hc
:
null
},
nls
.
localize
(
'
notificationsWarningForeground
'
,
"
Notifications warning foreground color. Notifications slide in from the top of the window.
"
));
export
const
NOTIFICATIONS_ERROR_BACKGROUND
=
registerColor
(
'
notification.errorBackground
'
,
{
dark
:
'
#BE1100
'
,
light
:
'
#BE1100
'
,
hc
:
contrastBorder
},
nls
.
localize
(
'
notificationsErrorBackground
'
,
"
Notifications error background color. Notifications slide in from the top of the window.
"
));
export
const
NOTIFICATIONS_ERROR_FOREGROUND
=
registerColor
(
'
notification.errorForeground
'
,
{
dark
:
NOTIFICATIONS_FOREGROUND
,
light
:
NOTIFICATIONS_FOREGROUND
,
hc
:
null
},
nls
.
localize
(
'
notificationsErrorForeground
'
,
"
Notifications error foreground color. Notifications slide in from the top of the window.
"
));
/**
* Base class for all themable workbench components.
*/
...
...
src/vs/workbench/services/message/browser/messageList.ts
浏览文件 @
87e691c9
...
...
@@ -19,10 +19,10 @@ import { Action } from 'vs/base/common/actions';
import
htmlRenderer
=
require
(
'
vs/base/browser/htmlContentRenderer
'
);
import
{
StandardKeyboardEvent
}
from
'
vs/base/browser/keyboardEvent
'
;
import
{
KeyCode
}
from
'
vs/base/common/keyCodes
'
;
import
{
NOTIFICATIONS_FOREGROUND
,
NOTIFICATIONS_BACKGROUND
}
from
'
vs/workbench/common/theme
'
;
import
{
NOTIFICATIONS_FOREGROUND
,
NOTIFICATIONS_BACKGROUND
,
NOTIFICATIONS_BUTTON_BACKGROUND
,
NOTIFICATIONS_BUTTON_HOVER_BACKGROUND
,
NOTIFICATIONS_BUTTON_FOREGROUND
,
NOTIFICATIONS_INFO_BACKGROUND
,
NOTIFICATIONS_WARNING_BACKGROUND
,
NOTIFICATIONS_ERROR_BACKGROUND
,
NOTIFICATIONS_INFO_FOREGROUND
,
NOTIFICATIONS_WARNING_FOREGROUND
,
NOTIFICATIONS_ERROR_FOREGROUND
}
from
'
vs/workbench/common/theme
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
registerThemingParticipant
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
contrastBorder
,
buttonBackground
,
buttonHoverBackground
,
widgetShadow
,
inputValidationErrorBorder
,
inputValidationWarningBorder
,
inputValidationInfoBorder
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
contrastBorder
,
widgetShadow
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
Color
}
from
'
vs/base/common/color
'
;
...
...
@@ -77,9 +77,13 @@ export class MessageList {
private
widgetShadow
=
Color
.
fromHex
(
'
#000000
'
);
private
outlineBorder
:
Color
;
private
buttonBackground
=
Color
.
fromHex
(
'
#0E639C
'
);
private
buttonForeground
=
this
.
foreground
;
private
infoBackground
=
Color
.
fromHex
(
'
#007ACC
'
);
private
infoForeground
=
this
.
foreground
;
private
warningBackground
=
Color
.
fromHex
(
'
#B89500
'
);
private
warningForeground
=
this
.
foreground
;
private
errorBackground
=
Color
.
fromHex
(
'
#BE1100
'
);
private
errorForeground
=
this
.
foreground
;
constructor
(
container
:
HTMLElement
,
...
...
@@ -106,12 +110,16 @@ export class MessageList {
this
.
foreground
=
theme
.
getColor
(
NOTIFICATIONS_FOREGROUND
);
this
.
widgetShadow
=
theme
.
getColor
(
widgetShadow
);
this
.
outlineBorder
=
theme
.
getColor
(
contrastBorder
);
this
.
buttonBackground
=
theme
.
getColor
(
buttonBackground
);
this
.
infoBackground
=
theme
.
getColor
(
inputValidationInfoBorder
);
this
.
warningBackground
=
theme
.
getColor
(
inputValidationWarningBorder
);
this
.
errorBackground
=
theme
.
getColor
(
inputValidationErrorBorder
);
const
buttonHoverBackgroundColor
=
theme
.
getColor
(
buttonHoverBackground
);
this
.
buttonBackground
=
theme
.
getColor
(
NOTIFICATIONS_BUTTON_BACKGROUND
);
this
.
buttonForeground
=
theme
.
getColor
(
NOTIFICATIONS_BUTTON_FOREGROUND
);
this
.
infoBackground
=
theme
.
getColor
(
NOTIFICATIONS_INFO_BACKGROUND
);
this
.
infoForeground
=
theme
.
getColor
(
NOTIFICATIONS_INFO_FOREGROUND
);
this
.
warningBackground
=
theme
.
getColor
(
NOTIFICATIONS_WARNING_BACKGROUND
);
this
.
warningForeground
=
theme
.
getColor
(
NOTIFICATIONS_WARNING_FOREGROUND
);
this
.
errorBackground
=
theme
.
getColor
(
NOTIFICATIONS_ERROR_BACKGROUND
);
this
.
errorForeground
=
theme
.
getColor
(
NOTIFICATIONS_ERROR_FOREGROUND
);
const
buttonHoverBackgroundColor
=
theme
.
getColor
(
NOTIFICATIONS_BUTTON_HOVER_BACKGROUND
);
if
(
buttonHoverBackgroundColor
)
{
collector
.
addRule
(
`.global-message-list li.message-list-entry .actions-container .message-action .action-button:hover { background-color:
${
buttonHoverBackgroundColor
}
!important; }`
);
}
...
...
@@ -281,6 +289,7 @@ export class MessageList {
div
.
a
({
class
:
'
action-button
'
,
tabindex
:
'
0
'
,
role
:
'
button
'
})
.
style
(
'
border-color
'
,
this
.
outlineBorder
?
this
.
outlineBorder
.
toString
()
:
null
)
.
style
(
'
background-color
'
,
this
.
buttonBackground
?
this
.
buttonBackground
.
toString
()
:
null
)
.
style
(
'
color
'
,
this
.
buttonForeground
?
this
.
buttonForeground
.
toString
()
:
null
)
.
text
(
action
.
label
)
.
on
([
DOM
.
EventType
.
CLICK
,
DOM
.
EventType
.
KEY_DOWN
],
e
=>
{
if
(
e
instanceof
KeyboardEvent
)
{
...
...
@@ -317,9 +326,11 @@ export class MessageList {
const
sev
=
message
.
severity
;
const
label
=
(
sev
===
Severity
.
Error
)
?
nls
.
localize
(
'
error
'
,
"
Error
"
)
:
(
sev
===
Severity
.
Warning
)
?
nls
.
localize
(
'
warning
'
,
"
Warn
"
)
:
nls
.
localize
(
'
info
'
,
"
Info
"
);
const
color
=
(
sev
===
Severity
.
Error
)
?
this
.
errorBackground
:
(
sev
===
Severity
.
Warning
)
?
this
.
warningBackground
:
this
.
infoBackground
;
const
foregroundColor
=
(
sev
===
Severity
.
Error
)
?
this
.
errorForeground
:
(
sev
===
Severity
.
Warning
)
?
this
.
warningForeground
:
this
.
infoForeground
;
const
sevLabel
=
$
().
span
({
class
:
`message-left-side severity
${
sev
===
Severity
.
Error
?
'
app-error
'
:
sev
===
Severity
.
Warning
?
'
app-warning
'
:
'
app-info
'
}
`
,
text
:
label
});
sevLabel
.
style
(
'
border-color
'
,
this
.
outlineBorder
?
this
.
outlineBorder
.
toString
()
:
null
);
sevLabel
.
style
(
'
background-color
'
,
color
?
color
.
toString
()
:
null
);
sevLabel
.
style
(
'
color
'
,
foregroundColor
?
foregroundColor
.
toString
()
:
null
);
sevLabel
.
appendTo
(
div
);
// Error message
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录