Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
e6132ead
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,发现更多精彩内容 >>
提交
e6132ead
编写于
8月 29, 2016
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
group feature specific styling rules #11095
上级
332908b2
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
42 addition
and
63 deletion
+42
-63
src/vs/workbench/services/themes/electron-browser/editorStyles.ts
...orkbench/services/themes/electron-browser/editorStyles.ts
+42
-63
未找到文件。
src/vs/workbench/services/themes/electron-browser/editorStyles.ts
浏览文件 @
e6132ead
...
...
@@ -69,17 +69,15 @@ export class EditorStylesContribution {
public
contributeStyles
(
themeId
:
string
,
themeDocument
:
IThemeDocument
):
string
[]
{
let
cssRules
=
[];
let
editorStyleRules
=
[
new
EditorBackgroundStyleRule
(),
new
EditorForegroundStyleRule
(),
new
EditorSelectionStyleRule
(),
new
EditorSelectionHighlightStyleRule
(),
new
EditorWordHighlightStyleRule
(),
new
EditorWordHighlightStrongStyleRule
(),
new
EditorFindLineHighlightStyleRule
(),
new
EditorCurrentLineHighlightStyleRule
(),
new
EditorCursorStyleRule
(),
new
EditorWhiteSpaceStyleRule
(),
new
EditorIndentGuidesStyleRule
()
new
EditorBackgroundStyleRules
(),
new
EditorForegroundStyleRules
(),
new
EditorCursorStyleRules
(),
new
EditorWhiteSpaceStyleRules
(),
new
EditorIndentGuidesStyleRules
(),
new
EditorCurrentLineHighlightStyleRules
(),
new
EditorSelectionStyleRules
(),
new
EditorWordHighlightStyleRules
(),
new
EditorFindStyleRules
()
];
let
editorStyles
=
new
EditorStyles
(
themeId
,
themeDocument
);
if
(
editorStyles
.
hasEditorStyleSettings
())
{
...
...
@@ -99,9 +97,14 @@ interface EditorStyleSettings {
invisibles
?:
string
;
guide
?:
string
;
lineHighlight
?:
string
;
selection
?:
string
;
selectionHighlight
?:
string
;
findLineHighlight
?:
string
;
findMatch
?:
string
;
currentFindMatch
?:
string
;
wordHighlight
?:
string
;
wordHighlightStrong
?:
string
;
}
...
...
@@ -133,24 +136,32 @@ class EditorStyles {
}
abstract
class
EditorStyleRule
{
protected
addBackgroundColorRule
(
editorStyles
:
EditorStyles
,
selector
:
string
,
color
:
string
|
Color
,
rules
:
string
[]):
void
{
if
(
color
)
{
color
=
color
instanceof
Color
?
color
:
new
Color
(
color
);
rules
.
push
(
`.monaco-editor.
${
editorStyles
.
getThemeSelector
()}
${
selector
}
{ background-color:
${
color
}
; }`
);
}
}
public
abstract
getCssRules
(
editorStyles
:
EditorStyles
):
string
[];
}
class
EditorBackgroundStyleRule
extends
EditorStyleRule
{
class
EditorBackgroundStyleRule
s
extends
EditorStyleRule
{
public
getCssRules
(
editorStyles
:
EditorStyles
):
string
[]
{
let
cssRules
=
[];
let
themeSelector
=
editorStyles
.
getThemeSelector
();
if
(
editorStyles
.
getEditorStyleSettings
().
background
)
{
let
background
=
new
Color
(
editorStyles
.
getEditorStyleSettings
().
background
);
cssRules
.
push
(
`.monaco-editor.
${
themeSelector
}
.monaco-editor-background { background-color:
${
background
}
; }`
);
cssRules
.
push
(
`.monaco-editor.
${
themeSelector
}
.glyph-margin { background-color:
${
background
}
; }`
);
this
.
addBackgroundColorRule
(
editorStyles
,
'
.monaco-editor-background
'
,
background
,
cssRules
);
this
.
addBackgroundColorRule
(
editorStyles
,
'
.glyph-margin
'
,
background
,
cssRules
);
cssRules
.
push
(
`.
${
themeSelector
}
.monaco-workbench .monaco-editor-background { background-color:
${
background
}
; }`
);
}
return
cssRules
;
}
}
class
EditorForegroundStyleRule
extends
EditorStyleRule
{
class
EditorForegroundStyleRule
s
extends
EditorStyleRule
{
public
getCssRules
(
editorStyles
:
EditorStyles
):
string
[]
{
let
cssRules
=
[];
let
themeSelector
=
editorStyles
.
getThemeSelector
();
...
...
@@ -162,80 +173,48 @@ class EditorForegroundStyleRule extends EditorStyleRule {
}
}
class
EditorSelectionStyleRule
extends
EditorStyleRule
{
class
EditorSelectionStyleRule
s
extends
EditorStyleRule
{
public
getCssRules
(
editorStyles
:
EditorStyles
):
string
[]
{
let
cssRules
=
[];
let
themeSelector
=
editorStyles
.
getThemeSelector
();
if
(
editorStyles
.
getEditorStyleSettings
().
selection
)
{
let
selection
=
new
Color
(
editorStyles
.
getEditorStyleSettings
().
selection
);
cssRules
.
push
(
`.monaco-editor.
${
themeSelector
}
.focused .selected-text { background-color:
${
selection
}
; }`
);
cssRules
.
push
(
`.monaco-editor.
${
themeSelector
}
.selected-text { background-color:
${
selection
.
transparent
(
0.5
)}
; }`
);
this
.
addBackgroundColorRule
(
editorStyles
,
'
.focused .selected-text
'
,
selection
,
cssRules
);
this
.
addBackgroundColorRule
(
editorStyles
,
'
.selected-text
'
,
selection
.
transparent
(
0.5
),
cssRules
);
}
return
cssRules
;
}
}
class
EditorSelectionHighlightStyleRule
extends
EditorStyleRule
{
public
getCssRules
(
editorStyles
:
EditorStyles
):
string
[]
{
let
cssRules
=
[];
let
themeSelector
=
editorStyles
.
getThemeSelector
();
if
(
editorStyles
.
getEditorStyleSettings
().
selectionHighlight
)
{
let
selection
=
new
Color
(
editorStyles
.
getEditorStyleSettings
().
selectionHighlight
);
cssRules
.
push
(
`.monaco-editor.
${
themeSelector
}
.selectionHighlight { background-color:
${
selection
}
; }`
);
}
this
.
addBackgroundColorRule
(
editorStyles
,
'
.selectionHighlight
'
,
editorStyles
.
getEditorStyleSettings
().
selectionHighlight
,
cssRules
);
return
cssRules
;
}
}
class
EditorWordHighlightStyleRule
extends
EditorStyleRule
{
class
EditorWordHighlightStyleRule
s
extends
EditorStyleRule
{
public
getCssRules
(
editorStyles
:
EditorStyles
):
string
[]
{
let
cssRules
=
[];
let
themeSelector
=
editorStyles
.
getThemeSelector
();
if
(
editorStyles
.
getEditorStyleSettings
().
wordHighlight
)
{
let
selection
=
new
Color
(
editorStyles
.
getEditorStyleSettings
().
wordHighlight
);
cssRules
.
push
(
`.monaco-editor.
${
themeSelector
}
.wordHighlight { background-color:
${
selection
}
; }`
);
}
return
cssRules
;
}
}
class
EditorWordHighlightStrongStyleRule
extends
EditorStyleRule
{
public
getCssRules
(
editorStyles
:
EditorStyles
):
string
[]
{
let
cssRules
=
[];
let
themeSelector
=
editorStyles
.
getThemeSelector
();
if
(
editorStyles
.
getEditorStyleSettings
().
wordHighlightStrong
)
{
let
selection
=
new
Color
(
editorStyles
.
getEditorStyleSettings
().
wordHighlightStrong
);
cssRules
.
push
(
`.monaco-editor.
${
themeSelector
}
.wordHighlightStrong { background-color:
${
selection
}
; }`
);
}
this
.
addBackgroundColorRule
(
editorStyles
,
'
.wordHighlight
'
,
editorStyles
.
getEditorStyleSettings
().
wordHighlight
,
cssRules
);
this
.
addBackgroundColorRule
(
editorStyles
,
'
.wordHighlightStrong
'
,
editorStyles
.
getEditorStyleSettings
().
wordHighlightStrong
,
cssRules
);
return
cssRules
;
}
}
class
EditorFind
LineHighlightStyleRule
extends
EditorStyleRule
{
class
EditorFind
StyleRules
extends
EditorStyleRule
{
public
getCssRules
(
editorStyles
:
EditorStyles
):
string
[]
{
let
cssRules
=
[];
let
themeSelector
=
editorStyles
.
getThemeSelector
();
if
(
editorStyles
.
getEditorStyleSettings
().
findLineHighlight
)
{
let
selection
=
new
Color
(
editorStyles
.
getEditorStyleSettings
().
findLineHighlight
);
cssRules
.
push
(
`.monaco-editor.
${
themeSelector
}
.findLineHighlight { background-color:
${
selection
}
; }`
);
}
this
.
addBackgroundColorRule
(
editorStyles
,
'
.findLineHighlight
'
,
editorStyles
.
getEditorStyleSettings
().
findLineHighlight
,
cssRules
);
this
.
addBackgroundColorRule
(
editorStyles
,
'
.findMatch
'
,
editorStyles
.
getEditorStyleSettings
().
findMatch
,
cssRules
);
this
.
addBackgroundColorRule
(
editorStyles
,
'
.currentFindMatch
'
,
editorStyles
.
getEditorStyleSettings
().
currentFindMatch
,
cssRules
);
return
cssRules
;
}
}
class
EditorCurrentLineHighlightStyleRule
extends
EditorStyleRule
{
class
EditorCurrentLineHighlightStyleRule
s
extends
EditorStyleRule
{
public
getCssRules
(
editorStyles
:
EditorStyles
):
string
[]
{
let
cssRules
=
[];
let
themeSelector
=
editorStyles
.
getThemeSelector
();
if
(
editorStyles
.
getEditorStyleSettings
().
lineHighlight
)
{
let
lineHighlight
=
new
Color
(
editorStyles
.
getEditorStyleSettings
().
lineHighlight
);
cssRules
.
push
(
`.monaco-editor.
${
themeSelector
}
.current-line { background-color:
${
lineHighlight
}
; border:0; }`
);
}
this
.
addBackgroundColorRule
(
editorStyles
,
'
.current-line
'
,
editorStyles
.
getEditorStyleSettings
().
lineHighlight
,
cssRules
);
return
cssRules
;
}
}
class
EditorCursorStyleRule
extends
EditorStyleRule
{
class
EditorCursorStyleRule
s
extends
EditorStyleRule
{
public
getCssRules
(
editorStyles
:
EditorStyles
):
string
[]
{
let
cssRules
=
[];
let
themeSelector
=
editorStyles
.
getThemeSelector
();
...
...
@@ -248,7 +227,7 @@ class EditorCursorStyleRule extends EditorStyleRule {
}
}
class
EditorWhiteSpaceStyleRule
extends
EditorStyleRule
{
class
EditorWhiteSpaceStyleRule
s
extends
EditorStyleRule
{
public
getCssRules
(
editorStyles
:
EditorStyles
):
string
[]
{
let
cssRules
=
[];
let
themeSelector
=
editorStyles
.
getThemeSelector
();
...
...
@@ -260,7 +239,7 @@ class EditorWhiteSpaceStyleRule extends EditorStyleRule {
}
}
class
EditorIndentGuidesStyleRule
extends
EditorStyleRule
{
class
EditorIndentGuidesStyleRule
s
extends
EditorStyleRule
{
public
getCssRules
(
editorStyles
:
EditorStyles
):
string
[]
{
let
cssRules
=
[];
let
themeSelector
=
editorStyles
.
getThemeSelector
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录