Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
42549722
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,发现更多精彩内容 >>
提交
42549722
编写于
9月 21, 2017
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
clean up styler
上级
1cf7612e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
97 addition
and
104 deletion
+97
-104
src/vs/platform/theme/common/styler.ts
src/vs/platform/theme/common/styler.ts
+97
-104
未找到文件。
src/vs/platform/theme/common/styler.ts
浏览文件 @
42549722
...
...
@@ -11,6 +11,10 @@ import { IDisposable } from 'vs/base/common/lifecycle';
export
type
styleFn
=
(
colors
:
{
[
name
:
string
]:
ColorIdentifier
})
=>
void
;
export
interface
IStyleOverrides
{
[
color
:
string
]:
ColorIdentifier
;
}
export
interface
IThemable
{
style
:
styleFn
;
}
...
...
@@ -43,36 +47,43 @@ export function attachStyler<T extends IColorMapping>(themeService: IThemeServic
return
themeService
.
onThemeChange
(
applyStyles
);
}
export
function
attachCheckboxStyler
(
widget
:
IThemable
,
themeService
:
IThemeService
,
style
?:
{
inputActiveOptionBorderColor
?:
ColorIdentifier
}):
IDisposable
{
export
interface
ICheckboxStyleOverrides
extends
IStyleOverrides
{
inputActiveOptionBorderColor
?:
ColorIdentifier
;
}
export
function
attachCheckboxStyler
(
widget
:
IThemable
,
themeService
:
IThemeService
,
style
?:
ICheckboxStyleOverrides
):
IDisposable
{
return
attachStyler
(
themeService
,
{
inputActiveOptionBorder
:
(
style
&&
style
.
inputActiveOptionBorderColor
)
||
inputActiveOptionBorder
},
widget
);
}
as
ICheckboxStyleOverrides
,
widget
);
}
export
function
attachBadgeStyler
(
widget
:
IThemable
,
themeService
:
IThemeService
,
style
?:
{
badgeBackground
?:
ColorIdentifier
,
badgeForeground
?:
ColorIdentifier
}):
IDisposable
{
export
interface
IBadgeStyleOverrides
extends
IStyleOverrides
{
badgeBackground
?:
ColorIdentifier
;
badgeForeground
?:
ColorIdentifier
;
}
export
function
attachBadgeStyler
(
widget
:
IThemable
,
themeService
:
IThemeService
,
style
?:
IBadgeStyleOverrides
):
IDisposable
{
return
attachStyler
(
themeService
,
{
badgeBackground
:
(
style
&&
style
.
badgeBackground
)
||
badgeBackground
,
badgeForeground
:
(
style
&&
style
.
badgeForeground
)
||
badgeForeground
,
badgeBorder
:
contrastBorder
},
widget
);
}
export
function
attachInputBoxStyler
(
widget
:
IThemable
,
themeService
:
IThemeService
,
style
?:
{
inputBackground
?:
ColorIdentifier
,
inputForeground
?:
ColorIdentifier
,
inputBorder
?:
ColorIdentifier
,
inputValidationInfoBorder
?:
ColorIdentifier
,
inputValidationInfoBackground
?:
ColorIdentifier
,
inputValidationWarningBorder
?:
ColorIdentifier
,
inputValidationWarningBackground
?:
ColorIdentifier
,
inputValidationErrorBorder
?:
ColorIdentifier
,
inputValidationErrorBackground
?:
ColorIdentifier
}):
IDisposable
{
}
as
IBadgeStyleOverrides
,
widget
);
}
export
interface
IInputBoxStyleOverrides
extends
IStyleOverrides
{
inputBackground
?:
ColorIdentifier
;
inputForeground
?:
ColorIdentifier
;
inputBorder
?:
ColorIdentifier
;
inputActiveOptionBorder
?:
ColorIdentifier
;
inputValidationInfoBorder
?:
ColorIdentifier
;
inputValidationInfoBackground
?:
ColorIdentifier
;
inputValidationWarningBorder
?:
ColorIdentifier
;
inputValidationWarningBackground
?:
ColorIdentifier
;
inputValidationErrorBorder
?:
ColorIdentifier
;
inputValidationErrorBackground
?:
ColorIdentifier
;
}
export
function
attachInputBoxStyler
(
widget
:
IThemable
,
themeService
:
IThemeService
,
style
?:
IInputBoxStyleOverrides
):
IDisposable
{
return
attachStyler
(
themeService
,
{
inputBackground
:
(
style
&&
style
.
inputBackground
)
||
inputBackground
,
inputForeground
:
(
style
&&
style
.
inputForeground
)
||
inputForeground
,
...
...
@@ -83,30 +94,24 @@ export function attachInputBoxStyler(widget: IThemable, themeService: IThemeServ
inputValidationWarningBackground
:
(
style
&&
style
.
inputValidationWarningBackground
)
||
inputValidationWarningBackground
,
inputValidationErrorBorder
:
(
style
&&
style
.
inputValidationErrorBorder
)
||
inputValidationErrorBorder
,
inputValidationErrorBackground
:
(
style
&&
style
.
inputValidationErrorBackground
)
||
inputValidationErrorBackground
},
widget
);
}
as
IInputBoxStyleOverrides
,
widget
);
}
export
function
attachSelectBoxStyler
(
widget
:
IThemable
,
themeService
:
IThemeService
,
style
?:
{
selectBackground
?:
ColorIdentifier
,
selectForeground
?:
ColorIdentifier
,
selectBorder
?:
ColorIdentifier
}):
IDisposable
{
export
interface
ISelectBoxStyleOverrides
extends
IStyleOverrides
{
selectBackground
?:
ColorIdentifier
;
selectForeground
?:
ColorIdentifier
;
selectBorder
?:
ColorIdentifier
;
}
export
function
attachSelectBoxStyler
(
widget
:
IThemable
,
themeService
:
IThemeService
,
style
?:
ISelectBoxStyleOverrides
):
IDisposable
{
return
attachStyler
(
themeService
,
{
selectBackground
:
(
style
&&
style
.
selectBackground
)
||
selectBackground
,
selectForeground
:
(
style
&&
style
.
selectForeground
)
||
selectForeground
,
selectBorder
:
(
style
&&
style
.
selectBorder
)
||
selectBorder
},
widget
);
}
export
function
attachFindInputBoxStyler
(
widget
:
IThemable
,
themeService
:
IThemeService
,
style
?:
{
inputBackground
?:
ColorIdentifier
,
inputForeground
?:
ColorIdentifier
,
inputBorder
?:
ColorIdentifier
,
inputActiveOptionBorder
?:
ColorIdentifier
,
inputValidationInfoBorder
?:
ColorIdentifier
,
inputValidationInfoBackground
?:
ColorIdentifier
,
inputValidationWarningBorder
?:
ColorIdentifier
,
inputValidationWarningBackground
?:
ColorIdentifier
,
inputValidationErrorBorder
?:
ColorIdentifier
,
inputValidationErrorBackground
?:
ColorIdentifier
}):
IDisposable
{
}
as
ISelectBoxStyleOverrides
,
widget
);
}
export
function
attachFindInputBoxStyler
(
widget
:
IThemable
,
themeService
:
IThemeService
,
style
?:
IInputBoxStyleOverrides
):
IDisposable
{
return
attachStyler
(
themeService
,
{
inputBackground
:
(
style
&&
style
.
inputBackground
)
||
inputBackground
,
inputForeground
:
(
style
&&
style
.
inputForeground
)
||
inputForeground
,
...
...
@@ -118,43 +123,19 @@ export function attachFindInputBoxStyler(widget: IThemable, themeService: ITheme
inputValidationWarningBackground
:
(
style
&&
style
.
inputValidationWarningBackground
)
||
inputValidationWarningBackground
,
inputValidationErrorBorder
:
(
style
&&
style
.
inputValidationErrorBorder
)
||
inputValidationErrorBorder
,
inputValidationErrorBackground
:
(
style
&&
style
.
inputValidationErrorBackground
)
||
inputValidationErrorBackground
},
widget
);
}
export
function
attachQuickOpenStyler
(
widget
:
IThemable
,
themeService
:
IThemeService
,
style
?:
{
foreground
?:
ColorIdentifier
,
background
?:
ColorIdentifier
,
borderColor
?:
ColorIdentifier
,
widgetShadow
?:
ColorIdentifier
,
progressBarBackground
?:
ColorIdentifier
,
inputBackground
?:
ColorIdentifier
,
inputForeground
?:
ColorIdentifier
,
inputBorder
?:
ColorIdentifier
,
inputValidationInfoBorder
?:
ColorIdentifier
,
inputValidationInfoBackground
?:
ColorIdentifier
,
inputValidationWarningBorder
?:
ColorIdentifier
,
inputValidationWarningBackground
?:
ColorIdentifier
,
inputValidationErrorBorder
?:
ColorIdentifier
,
inputValidationErrorBackground
?:
ColorIdentifier
pickerGroupForeground
?:
ColorIdentifier
,
pickerGroupBorder
?:
ColorIdentifier
,
listFocusBackground
?:
ColorIdentifier
,
listFocusForeground
?:
ColorIdentifier
,
listActiveSelectionBackground
?:
ColorIdentifier
,
listActiveSelectionForeground
?:
ColorIdentifier
,
listFocusAndSelectionBackground
?:
ColorIdentifier
,
listFocusAndSelectionForeground
?:
ColorIdentifier
,
listInactiveSelectionBackground
?:
ColorIdentifier
,
listInactiveSelectionForeground
?:
ColorIdentifier
,
listInactiveFocusBackground
?:
ColorIdentifier
,
listInactiveFocusForeground
?:
ColorIdentifier
,
listHoverBackground
?:
ColorIdentifier
,
listHoverForeground
?:
ColorIdentifier
,
listDropBackground
?:
ColorIdentifier
,
listFocusOutline
?:
ColorIdentifier
,
listSelectionOutline
?:
ColorIdentifier
,
listHoverOutline
?:
ColorIdentifier
}):
IDisposable
{
}
as
IInputBoxStyleOverrides
,
widget
);
}
export
interface
IQuickOpenStyleOverrides
extends
IListStyleOverrides
,
IInputBoxStyleOverrides
,
IProgressBarStyleOverrides
{
foreground
?:
ColorIdentifier
;
background
?:
ColorIdentifier
;
borderColor
?:
ColorIdentifier
;
widgetShadow
?:
ColorIdentifier
;
pickerGroupForeground
?:
ColorIdentifier
;
pickerGroupBorder
?:
ColorIdentifier
;
};
export
function
attachQuickOpenStyler
(
widget
:
IThemable
,
themeService
:
IThemeService
,
style
?:
IQuickOpenStyleOverrides
):
IDisposable
{
return
attachStyler
(
themeService
,
{
foreground
:
(
style
&&
style
.
foreground
)
||
foreground
,
background
:
(
style
&&
style
.
background
)
||
editorBackground
,
...
...
@@ -188,28 +169,30 @@ export function attachQuickOpenStyler(widget: IThemable, themeService: IThemeSer
listFocusOutline
:
(
style
&&
style
.
listFocusOutline
)
||
activeContrastBorder
,
listSelectionOutline
:
(
style
&&
style
.
listSelectionOutline
)
||
activeContrastBorder
,
listHoverOutline
:
(
style
&&
style
.
listHoverOutline
)
||
activeContrastBorder
},
widget
);
}
export
function
attachListStyler
(
widget
:
IThemable
,
themeService
:
IThemeService
,
style
?:
{
listFocusBackground
?:
ColorIdentifier
,
listFocusForeground
?:
ColorIdentifier
,
listActiveSelectionBackground
?:
ColorIdentifier
,
listActiveSelectionForeground
?:
ColorIdentifier
,
listFocusAndSelectionBackground
?:
ColorIdentifier
,
listFocusAndSelectionForeground
?:
ColorIdentifier
,
listInactiveSelectionBackground
?:
ColorIdentifier
,
listInactiveSelectionForeground
?:
ColorIdentifier
,
listInactiveFocusBackground
?:
ColorIdentifier
,
listInactiveFocusForeground
?:
ColorIdentifier
,
listHoverBackground
?:
ColorIdentifier
,
listHoverForeground
?:
ColorIdentifier
,
listDropBackground
?:
ColorIdentifier
,
listFocusOutline
?:
ColorIdentifier
,
listInactiveFocusOutline
?:
ColorIdentifier
,
listSelectionOutline
?:
ColorIdentifier
,
listHoverOutline
?:
ColorIdentifier
,
}):
IDisposable
{
}
as
IQuickOpenStyleOverrides
,
widget
);
}
export
interface
IListStyleOverrides
extends
IStyleOverrides
{
listFocusBackground
?:
ColorIdentifier
;
listFocusForeground
?:
ColorIdentifier
;
listActiveSelectionBackground
?:
ColorIdentifier
;
listActiveSelectionForeground
?:
ColorIdentifier
;
listFocusAndSelectionBackground
?:
ColorIdentifier
;
listFocusAndSelectionForeground
?:
ColorIdentifier
;
listInactiveSelectionBackground
?:
ColorIdentifier
;
listInactiveSelectionForeground
?:
ColorIdentifier
;
listInactiveFocusBackground
?:
ColorIdentifier
;
listInactiveFocusForeground
?:
ColorIdentifier
;
listHoverBackground
?:
ColorIdentifier
;
listHoverForeground
?:
ColorIdentifier
;
listDropBackground
?:
ColorIdentifier
;
listFocusOutline
?:
ColorIdentifier
;
listInactiveFocusOutline
?:
ColorIdentifier
;
listSelectionOutline
?:
ColorIdentifier
;
listHoverOutline
?:
ColorIdentifier
;
}
export
function
attachListStyler
(
widget
:
IThemable
,
themeService
:
IThemeService
,
style
?:
IListStyleOverrides
):
IDisposable
{
return
attachStyler
(
themeService
,
{
listFocusBackground
:
(
style
&&
style
.
listFocusBackground
)
||
listFocusBackground
,
listFocusForeground
:
(
style
&&
style
.
listFocusForeground
)
||
listFocusForeground
,
...
...
@@ -228,22 +211,32 @@ export function attachListStyler(widget: IThemable, themeService: IThemeService,
listSelectionOutline
:
(
style
&&
style
.
listSelectionOutline
)
||
activeContrastBorder
,
listHoverOutline
:
(
style
&&
style
.
listHoverOutline
)
||
activeContrastBorder
,
listInactiveFocusOutline
:
style
&&
style
.
listInactiveFocusOutline
// not defined by default, only opt-in
},
widget
);
}
as
IListStyleOverrides
,
widget
);
}
export
interface
IButtonStyleOverrides
extends
IStyleOverrides
{
buttonForeground
?:
ColorIdentifier
;
buttonBackground
?:
ColorIdentifier
;
buttonHoverBackground
?:
ColorIdentifier
;
}
export
function
attachButtonStyler
(
widget
:
IThemable
,
themeService
:
IThemeService
,
style
?:
{
buttonForeground
?:
ColorIdentifier
,
buttonBackground
?:
ColorIdentifier
,
buttonHoverBackground
?:
ColorIdentifier
}
):
IDisposable
{
export
function
attachButtonStyler
(
widget
:
IThemable
,
themeService
:
IThemeService
,
style
?:
IButtonStyleOverrides
):
IDisposable
{
return
attachStyler
(
themeService
,
{
buttonForeground
:
(
style
&&
style
.
buttonForeground
)
||
buttonForeground
,
buttonBackground
:
(
style
&&
style
.
buttonBackground
)
||
buttonBackground
,
buttonHoverBackground
:
(
style
&&
style
.
buttonHoverBackground
)
||
buttonHoverBackground
,
buttonBorder
:
contrastBorder
},
widget
);
}
as
IButtonStyleOverrides
,
widget
);
}
export
interface
IProgressBarStyleOverrides
extends
IStyleOverrides
{
progressBarBackground
?:
ColorIdentifier
;
}
export
function
attachProgressBarStyler
(
widget
:
IThemable
,
themeService
:
IThemeService
,
style
?:
{
progressBarBackground
?:
ColorIdentifier
}
):
IDisposable
{
export
function
attachProgressBarStyler
(
widget
:
IThemable
,
themeService
:
IThemeService
,
style
?:
IProgressBarStyleOverrides
):
IDisposable
{
return
attachStyler
(
themeService
,
{
progressBarBackground
:
(
style
&&
style
.
progressBarBackground
)
||
progressBarBackground
},
widget
);
}
as
IProgressBarStyleOverrides
,
widget
);
}
export
function
attachStylerCallback
(
themeService
:
IThemeService
,
colors
:
{
[
name
:
string
]:
ColorIdentifier
},
callback
:
styleFn
):
IDisposable
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录