Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
99dafc38
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,发现更多精彩内容 >>
提交
99dafc38
编写于
3月 21, 2017
作者:
M
Martin Aeschlimann
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[theme] adopt ITheme in standalone editor
上级
d97b01e3
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
423 addition
and
294 deletion
+423
-294
build/monaco/monaco.d.ts.recipe
build/monaco/monaco.d.ts.recipe
+2
-2
src/vs/editor/browser/services/standaloneColorServiceImpl.ts
src/vs/editor/browser/services/standaloneColorServiceImpl.ts
+126
-36
src/vs/editor/browser/standalone/standaloneEditor.ts
src/vs/editor/browser/standalone/standaloneEditor.ts
+2
-2
src/vs/editor/browser/standalone/standaloneLanguages.ts
src/vs/editor/browser/standalone/standaloneLanguages.ts
+2
-2
src/vs/editor/common/modes/monarch/monarchLexer.ts
src/vs/editor/common/modes/monarch/monarchLexer.ts
+4
-4
src/vs/editor/common/modes/supports/tokenization.ts
src/vs/editor/common/modes/supports/tokenization.ts
+12
-12
src/vs/editor/common/services/standaloneColorService.ts
src/vs/editor/common/services/standaloneColorService.ts
+12
-5
src/vs/editor/common/standalone/themes.ts
src/vs/editor/common/standalone/themes.ts
+201
-172
src/vs/editor/test/common/modes/supports/tokenization.test.ts
...vs/editor/test/common/modes/supports/tokenization.test.ts
+53
-53
src/vs/monaco.d.ts
src/vs/monaco.d.ts
+9
-4
src/vs/platform/theme/common/themeService.ts
src/vs/platform/theme/common/themeService.ts
+0
-1
src/vs/workbench/test/workbenchTestServices.ts
src/vs/workbench/test/workbenchTestServices.ts
+0
-1
未找到文件。
build/monaco/monaco.d.ts.recipe
浏览文件 @
99dafc38
...
...
@@ -53,8 +53,8 @@ declare module monaco {
declare module monaco.editor {
#includeAll(vs/editor/browser/standalone/standaloneEditor;modes.=>languages.;editorCommon.=>):
#include(vs/editor/common/services/standaloneColorService): BuiltinTheme, I
Theme
#include(vs/editor/common/modes/supports/tokenization): IThemeRule
#include(vs/editor/common/services/standaloneColorService): BuiltinTheme, I
StandaloneThemeData, IColors
#include(vs/editor/common/modes/supports/tokenization): IT
okenT
hemeRule
#include(vs/editor/common/services/webWorker): MonacoWebWorker, IWebWorkerOptions
#include(vs/editor/browser/standalone/standaloneCodeEditor): IEditorConstructionOptions, IDiffEditorConstructionOptions, IStandaloneCodeEditor, IStandaloneDiffEditor
export interface ICommandHandler {
...
...
src/vs/editor/browser/services/standaloneColorServiceImpl.ts
浏览文件 @
99dafc38
...
...
@@ -4,25 +4,91 @@
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
T
heme
,
I
ThemeRule
,
generateTokensCSSForColorMap
}
from
'
vs/editor/common/modes/supports/tokenization
'
;
import
{
IStandaloneColorService
,
BuiltinTheme
,
I
Theme
}
from
'
vs/editor/common/services/standaloneColorService
'
;
import
{
T
okenTheme
,
IToken
ThemeRule
,
generateTokensCSSForColorMap
}
from
'
vs/editor/common/modes/supports/tokenization
'
;
import
{
IStandaloneColorService
,
BuiltinTheme
,
I
StandaloneThemeData
,
IStandaloneTheme
,
IColors
}
from
'
vs/editor/common/services/standaloneColorService
'
;
import
{
vs
,
vs_dark
,
hc_black
}
from
'
vs/editor/common/standalone/themes
'
;
import
*
as
dom
from
'
vs/base/browser/dom
'
;
import
{
TokenizationRegistry
}
from
'
vs/editor/common/modes
'
;
import
{
Color
}
from
"
vs/base/common/color
"
;
import
{
Extensions
,
IColorRegistry
,
ColorIdentifier
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
Extensions
as
ThemingExtensions
,
IThemingRegistry
,
ICssStyleCollector
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
Registry
}
from
'
vs/platform/platform
'
;
c
lass
KnownTheme
{
cssClassName
:
string
;
rules
:
IThemeRule
[]
;
c
onst
VS_THEME_NAME
=
'
vs
'
;
const
VS_DARK_THEME_NAME
=
'
vs-dark
'
;
const
HC_BLACK_THEME_NAME
=
'
hc-black
'
;
constructor
(
cssClassName
:
string
,
rules
:
IThemeRule
[])
{
this
.
cssClassName
=
cssClassName
;
const
colorRegistry
=
<
IColorRegistry
>
Registry
.
as
(
Extensions
.
ColorContribution
);
const
themingRegistry
=
Registry
.
as
<
IThemingRegistry
>
(
ThemingExtensions
.
ThemingContribution
);
class
StandaloneTheme
implements
IStandaloneTheme
{
id
:
string
;
selector
:
string
;
private
rules
:
ITokenThemeRule
[];
base
:
string
;
private
colors
:
{
[
colorId
:
string
]:
Color
};
private
defaultColors
:
{
[
colorId
:
string
]:
Color
};
private
_tokenTheme
:
TokenTheme
;
constructor
(
base
:
string
,
name
:
string
,
colors
:
IColors
,
rules
:
ITokenThemeRule
[])
{
if
(
name
.
length
>
0
)
{
this
.
id
=
base
+
'
'
+
name
;
this
.
selector
=
base
+
'
.
'
+
name
;
}
else
{
this
.
id
=
base
;
this
.
selector
=
base
;
}
this
.
rules
=
rules
;
this
.
colors
=
{};
for
(
let
id
in
colors
)
{
this
.
colors
[
id
]
=
Color
.
fromHex
(
colors
[
id
]);
}
this
.
defaultColors
=
{};
}
}
const
VS_THEME_NAME
=
'
vs
'
;
const
VS_DARK_THEME_NAME
=
'
vs-dark
'
;
const
HC_BLACK_THEME_NAME
=
'
hc-black
'
;
public
getColor
(
colorId
:
ColorIdentifier
,
useDefault
?:
boolean
):
Color
{
if
(
this
.
colors
.
hasOwnProperty
(
colorId
))
{
return
this
.
colors
[
colorId
];
}
if
(
useDefault
!==
false
)
{
return
this
.
getDefault
(
colorId
);
}
return
null
;
}
private
getDefault
(
colorId
:
ColorIdentifier
):
Color
{
if
(
this
.
defaultColors
.
hasOwnProperty
(
colorId
))
{
return
this
.
defaultColors
[
colorId
];
}
let
color
=
colorRegistry
.
resolveDefaultColor
(
colorId
,
this
);
this
.
defaultColors
[
colorId
]
=
color
;
return
color
;
}
public
isDefault
(
colorId
:
ColorIdentifier
):
boolean
{
if
(
!
this
.
colors
.
hasOwnProperty
(
colorId
))
{
return
true
;
}
let
color
=
this
.
colors
[
colorId
];
let
defaultValue
=
this
.
getDefault
(
colorId
);
return
color
?
!!
defaultValue
:
color
.
equals
(
defaultValue
);
}
public
get
type
()
{
switch
(
this
.
base
)
{
case
VS_THEME_NAME
:
return
'
light
'
;
case
HC_BLACK_THEME_NAME
:
return
'
hc
'
;
default
:
return
'
dark
'
;
}
}
public
get
tokenTheme
():
TokenTheme
{
if
(
!
this
.
_tokenTheme
)
{
this
.
_tokenTheme
=
TokenTheme
.
createFromRawTokenTheme
(
this
.
rules
);
}
return
this
.
_tokenTheme
;
}
}
function
isBuiltinTheme
(
themeName
:
string
):
themeName
is
BuiltinTheme
{
return
(
...
...
@@ -32,7 +98,7 @@ function isBuiltinTheme(themeName: string): themeName is BuiltinTheme {
);
}
function
getBuiltinRules
(
builtinTheme
:
BuiltinTheme
):
I
ThemeRule
[]
{
function
getBuiltinRules
(
builtinTheme
:
BuiltinTheme
):
I
StandaloneThemeData
{
switch
(
builtinTheme
)
{
case
VS_THEME_NAME
:
return
vs
;
...
...
@@ -43,25 +109,30 @@ function getBuiltinRules(builtinTheme: BuiltinTheme): IThemeRule[] {
}
}
function
newBuiltInTheme
(
builtinTheme
:
BuiltinTheme
):
StandaloneTheme
{
let
themeData
=
getBuiltinRules
(
builtinTheme
);
return
new
StandaloneTheme
(
builtinTheme
,
''
,
themeData
.
colors
,
themeData
.
rules
);
}
export
class
StandaloneColorServiceImpl
implements
IStandaloneColorService
{
_serviceBrand
:
any
;
private
_knownThemes
:
Map
<
string
,
Known
Theme
>
;
private
_knownThemes
:
Map
<
string
,
Standalone
Theme
>
;
private
_styleElement
:
HTMLStyleElement
;
private
_theme
:
Theme
;
private
_theme
:
IStandalone
Theme
;
constructor
()
{
this
.
_knownThemes
=
new
Map
<
string
,
Known
Theme
>
();
this
.
_knownThemes
.
set
(
VS_THEME_NAME
,
new
KnownTheme
(
VS_THEME_NAME
,
getBuiltinRules
(
VS_THEME_NAME
)
));
this
.
_knownThemes
.
set
(
VS_DARK_THEME_NAME
,
new
KnownTheme
(
VS_DARK_THEME_NAME
,
getBuiltinRules
(
VS_DARK_THEME_NAME
)
));
this
.
_knownThemes
.
set
(
HC_BLACK_THEME_NAME
,
new
KnownTheme
(
HC_BLACK_THEME_NAME
,
getBuiltinRules
(
HC_BLACK_THEME_NAME
)
));
this
.
_knownThemes
=
new
Map
<
string
,
Standalone
Theme
>
();
this
.
_knownThemes
.
set
(
VS_THEME_NAME
,
new
BuiltInTheme
(
VS_THEME_NAME
));
this
.
_knownThemes
.
set
(
VS_DARK_THEME_NAME
,
new
BuiltInTheme
(
VS_DARK_THEME_NAME
));
this
.
_knownThemes
.
set
(
HC_BLACK_THEME_NAME
,
new
BuiltInTheme
(
HC_BLACK_THEME_NAME
));
this
.
_styleElement
=
dom
.
createStyleSheet
();
this
.
_styleElement
.
className
=
'
monaco-
tokens-style
s
'
;
this
.
_styleElement
.
className
=
'
monaco-
color
s
'
;
this
.
setTheme
(
VS_THEME_NAME
);
}
public
defineTheme
(
themeName
:
string
,
themeData
:
I
Theme
):
void
{
public
defineTheme
(
themeName
:
string
,
themeData
:
I
StandaloneThemeData
):
void
{
if
(
!
/^
[
a-z0-9
\-]
+$/i
.
test
(
themeName
)
||
isBuiltinTheme
(
themeName
))
{
throw
new
Error
(
'
Illegal theme name!
'
);
}
...
...
@@ -69,37 +140,56 @@ export class StandaloneColorServiceImpl implements IStandaloneColorService {
throw
new
Error
(
'
Illegal theme base!
'
);
}
let
cssClassName
=
themeData
.
base
+
'
'
+
themeName
;
let
rules
:
IThemeRule
[]
=
[];
let
rules
:
ITokenThemeRule
[]
=
[];
let
colors
:
IColors
=
{};
if
(
themeData
.
inherit
)
{
rules
=
rules
.
concat
(
getBuiltinRules
(
themeData
.
base
));
let
baseData
=
getBuiltinRules
(
themeData
.
base
);
rules
=
rules
.
concat
(
baseData
.
rules
);
for
(
let
id
in
baseData
.
colors
)
{
colors
[
id
]
=
baseData
.
colors
[
id
];
}
}
rules
=
rules
.
concat
(
themeData
.
rules
);
for
(
let
id
in
themeData
.
colors
)
{
colors
[
id
]
=
themeData
.
colors
[
id
];
}
this
.
_knownThemes
.
set
(
themeName
,
new
KnownTheme
(
cssClassName
,
rules
));
this
.
_knownThemes
.
set
(
themeName
,
new
StandaloneTheme
(
themeData
.
base
,
themeName
,
colors
,
rules
));
}
public
getTheme
():
Theme
{
public
getTheme
():
IStandalone
Theme
{
return
this
.
_theme
;
}
public
setTheme
(
themeName
:
string
):
string
{
let
theme
Data
:
Known
Theme
;
let
theme
:
Standalone
Theme
;
if
(
this
.
_knownThemes
.
has
(
themeName
))
{
theme
Data
=
this
.
_knownThemes
.
get
(
themeName
);
theme
=
this
.
_knownThemes
.
get
(
themeName
);
}
else
{
theme
Data
=
this
.
_knownThemes
.
get
(
VS_THEME_NAME
);
theme
=
this
.
_knownThemes
.
get
(
VS_THEME_NAME
);
}
this
.
_theme
=
Theme
.
createFromRawTheme
(
themeData
.
rules
);
let
colorMap
=
this
.
_theme
.
getColorMap
();
let
cssRules
=
generateTokensCSSForColorMap
(
colorMap
);
this
.
_styleElement
.
innerHTML
=
cssRules
;
this
.
_theme
=
theme
;
let
cssRules
=
[];
let
hasRule
=
{};
let
ruleCollector
:
ICssStyleCollector
=
{
addRule
:
(
rule
:
string
)
=>
{
if
(
!
hasRule
[
rule
])
{
cssRules
.
push
(
rule
);
hasRule
[
rule
]
=
true
;
}
}
};
themingRegistry
.
getThemingParticipants
().
forEach
(
p
=>
p
(
theme
,
ruleCollector
));
let
tokenTheme
=
theme
.
tokenTheme
;
let
colorMap
=
tokenTheme
.
getColorMap
();
ruleCollector
.
addRule
(
generateTokensCSSForColorMap
(
colorMap
));
this
.
_styleElement
.
innerHTML
=
cssRules
.
join
(
'
\n
'
);
TokenizationRegistry
.
setColorMap
(
colorMap
);
return
theme
Data
.
cssClassName
;
return
theme
.
id
;
}
}
src/vs/editor/browser/standalone/standaloneEditor.ts
浏览文件 @
99dafc38
...
...
@@ -31,7 +31,7 @@ import { ICodeEditorService } from 'vs/editor/common/services/codeEditorService'
import
{
IEditorWorkerService
}
from
'
vs/editor/common/services/editorWorkerService
'
;
import
{
ITextModelResolverService
}
from
'
vs/editor/common/services/resolverService
'
;
import
{
NULL_STATE
,
nullTokenize
}
from
'
vs/editor/common/modes/nullMode
'
;
import
{
I
Theme
,
IStandaloneColorService
}
from
'
vs/editor/common/services/standaloneColorService
'
;
import
{
I
StandaloneThemeData
,
IStandaloneColorService
}
from
'
vs/editor/common/services/standaloneColorService
'
;
import
{
Token
}
from
'
vs/editor/common/core/token
'
;
import
{
FontInfo
,
BareFontInfo
}
from
'
vs/editor/common/config/fontInfo
'
;
...
...
@@ -301,7 +301,7 @@ export function tokenize(text: string, languageId: string): Token[][] {
/**
* Define a new theme.
*/
export
function
defineTheme
(
themeName
:
string
,
themeData
:
I
Theme
):
void
{
export
function
defineTheme
(
themeName
:
string
,
themeData
:
I
StandaloneThemeData
):
void
{
StaticServices
.
standaloneColorService
.
get
().
defineTheme
(
themeName
,
themeData
);
}
...
...
src/vs/editor/browser/standalone/standaloneLanguages.ts
浏览文件 @
99dafc38
...
...
@@ -113,12 +113,12 @@ export class TokenizationSupport2Adapter implements modes.ITokenizationSupport {
private
_toBinaryTokens
(
tokens
:
IToken
[],
offsetDelta
:
number
):
Uint32Array
{
let
languageId
=
this
.
_languageIdentifier
.
id
;
let
t
heme
=
this
.
_standaloneColorService
.
getTheme
()
;
let
t
okenTheme
=
this
.
_standaloneColorService
.
getTheme
().
tokenTheme
;
let
result
:
number
[]
=
[],
resultLen
=
0
;
for
(
let
i
=
0
,
len
=
tokens
.
length
;
i
<
len
;
i
++
)
{
let
t
=
tokens
[
i
];
let
metadata
=
theme
.
match
(
languageId
,
t
.
scopes
);
let
metadata
=
t
okenT
heme
.
match
(
languageId
,
t
.
scopes
);
if
(
resultLen
>
0
&&
result
[
resultLen
-
1
]
===
metadata
)
{
// same metadata
continue
;
...
...
src/vs/editor/common/modes/monarch/monarchLexer.ts
浏览文件 @
99dafc38
...
...
@@ -16,7 +16,7 @@ import { IModeService } from 'vs/editor/common/services/modeService';
import
{
Token
,
TokenizationResult
,
TokenizationResult2
}
from
'
vs/editor/common/core/token
'
;
import
{
NULL_STATE
,
NULL_MODE_ID
}
from
'
vs/editor/common/modes/nullMode
'
;
import
{
IStandaloneColorService
}
from
'
vs/editor/common/services/standaloneColorService
'
;
import
{
Theme
}
from
'
vs/editor/common/modes/supports/tokenization
'
;
import
{
T
okenT
heme
}
from
'
vs/editor/common/modes/supports/tokenization
'
;
const
CACHE_STACK_DEPTH
=
5
;
...
...
@@ -291,13 +291,13 @@ class MonarchClassicTokensCollector implements IMonarchTokensCollector {
class
MonarchModernTokensCollector
implements
IMonarchTokensCollector
{
private
_modeService
:
IModeService
;
private
_theme
:
Theme
;
private
_theme
:
T
okenT
heme
;
private
_prependTokens
:
Uint32Array
;
private
_tokens
:
number
[];
private
_currentLanguageId
:
modes
.
LanguageId
;
private
_lastTokenMetadata
:
number
;
constructor
(
modeService
:
IModeService
,
theme
:
Theme
)
{
constructor
(
modeService
:
IModeService
,
theme
:
T
okenT
heme
)
{
this
.
_modeService
=
modeService
;
this
.
_theme
=
theme
;
this
.
_prependTokens
=
null
;
...
...
@@ -429,7 +429,7 @@ export class MonarchTokenizer implements modes.ITokenizationSupport {
}
public
tokenize2
(
line
:
string
,
lineState
:
modes
.
IState
,
offsetDelta
:
number
):
TokenizationResult2
{
let
tokensCollector
=
new
MonarchModernTokensCollector
(
this
.
_modeService
,
this
.
_standaloneColorService
.
getTheme
());
let
tokensCollector
=
new
MonarchModernTokensCollector
(
this
.
_modeService
,
this
.
_standaloneColorService
.
getTheme
()
.
tokenTheme
);
let
endLineState
=
this
.
_tokenize
(
line
,
<
MonarchLineState
>
lineState
,
offsetDelta
,
tokensCollector
);
return
tokensCollector
.
finalize
(
endLineState
);
}
...
...
src/vs/editor/common/modes/supports/tokenization.ts
浏览文件 @
99dafc38
...
...
@@ -7,14 +7,14 @@
import
{
ColorId
,
FontStyle
,
MetadataConsts
,
LanguageId
,
StandardTokenType
}
from
'
vs/editor/common/modes
'
;
import
{
Color
}
from
'
vs/base/common/color
'
;
export
interface
IThemeRule
{
export
interface
IT
okenT
hemeRule
{
token
:
string
;
foreground
?:
string
;
background
?:
string
;
fontStyle
?:
string
;
}
export
class
ParsedThemeRule
{
export
class
ParsedT
okenT
hemeRule
{
_parsedThemeRuleBrand
:
void
;
readonly
token
:
string
;
...
...
@@ -45,11 +45,11 @@ export class ParsedThemeRule {
/**
* Parse a raw theme into rules.
*/
export
function
parseT
heme
(
source
:
IThemeRule
[]):
Parsed
ThemeRule
[]
{
export
function
parseT
okenTheme
(
source
:
ITokenThemeRule
[]):
ParsedToken
ThemeRule
[]
{
if
(
!
source
||
!
Array
.
isArray
(
source
))
{
return
[];
}
let
result
:
ParsedThemeRule
[]
=
[],
resultLen
=
0
;
let
result
:
ParsedT
okenT
hemeRule
[]
=
[],
resultLen
=
0
;
for
(
let
i
=
0
,
len
=
source
.
length
;
i
<
len
;
i
++
)
{
let
entry
=
source
[
i
];
...
...
@@ -84,7 +84,7 @@ export function parseTheme(source: IThemeRule[]): ParsedThemeRule[] {
background
=
entry
.
background
;
}
result
[
resultLen
++
]
=
new
ParsedThemeRule
(
result
[
resultLen
++
]
=
new
ParsedT
okenT
hemeRule
(
entry
.
token
||
''
,
i
,
fontStyle
,
...
...
@@ -99,7 +99,7 @@ export function parseTheme(source: IThemeRule[]): ParsedThemeRule[] {
/**
* Resolve rules (i.e. inheritance).
*/
function
resolveParsedT
hemeRules
(
parsedThemeRules
:
ParsedThemeRule
[]):
Theme
{
function
resolveParsedT
okenThemeRules
(
parsedThemeRules
:
ParsedTokenThemeRule
[]):
Token
Theme
{
// Sort rules lexicographically, and then by index if necessary
parsedThemeRules
.
sort
((
a
,
b
)
=>
{
...
...
@@ -136,7 +136,7 @@ function resolveParsedThemeRules(parsedThemeRules: ParsedThemeRule[]): Theme {
root
.
insert
(
rule
.
token
,
rule
.
fontStyle
,
colorMap
.
getId
(
rule
.
foreground
),
colorMap
.
getId
(
rule
.
background
));
}
return
new
Theme
(
colorMap
,
root
);
return
new
T
okenT
heme
(
colorMap
,
root
);
}
export
class
ColorMap
{
...
...
@@ -175,14 +175,14 @@ export class ColorMap {
}
export
class
Theme
{
export
class
T
okenT
heme
{
public
static
createFromRawT
heme
(
source
:
IThemeRule
[]):
Theme
{
return
this
.
createFromParsedT
heme
(
parse
Theme
(
source
));
public
static
createFromRawT
okenTheme
(
source
:
ITokenThemeRule
[]):
Token
Theme
{
return
this
.
createFromParsedT
okenTheme
(
parseToken
Theme
(
source
));
}
public
static
createFromParsedT
heme
(
source
:
ParsedThemeRule
[]):
Theme
{
return
resolveParsedThemeRules
(
source
);
public
static
createFromParsedT
okenTheme
(
source
:
ParsedTokenThemeRule
[]):
Token
Theme
{
return
resolveParsedT
okenT
hemeRules
(
source
);
}
private
readonly
_colorMap
:
ColorMap
;
...
...
src/vs/editor/common/services/standaloneColorService.ts
浏览文件 @
99dafc38
...
...
@@ -5,16 +5,23 @@
'
use strict
'
;
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
Theme
,
IThemeRule
}
from
'
vs/editor/common/modes/supports/tokenization
'
;
import
{
TokenTheme
,
ITokenThemeRule
}
from
'
vs/editor/common/modes/supports/tokenization
'
;
import
{
ITheme
}
from
"
vs/platform/theme/common/themeService
"
;
export
var
IStandaloneColorService
=
createDecorator
<
IStandaloneColorService
>
(
'
standaloneColorService
'
);
export
type
BuiltinTheme
=
'
vs
'
|
'
vs-dark
'
|
'
hc-black
'
;
export
type
IColors
=
{
[
colorId
:
string
]:
string
;
};
export
interface
I
Theme
{
export
interface
I
StandaloneThemeData
{
base
:
BuiltinTheme
;
inherit
:
boolean
;
rules
:
IThemeRule
[];
rules
:
ITokenThemeRule
[];
colors
:
IColors
;
}
export
interface
IStandaloneTheme
extends
ITheme
{
tokenTheme
:
TokenTheme
;
}
export
interface
IStandaloneColorService
{
...
...
@@ -22,7 +29,7 @@ export interface IStandaloneColorService {
setTheme
(
themeName
:
string
):
string
;
defineTheme
(
themeName
:
string
,
themeData
:
I
Theme
):
void
;
defineTheme
(
themeName
:
string
,
themeData
:
I
StandaloneThemeData
):
void
;
getTheme
():
Theme
;
getTheme
():
IStandalone
Theme
;
}
src/vs/editor/common/standalone/themes.ts
浏览文件 @
99dafc38
...
...
@@ -5,175 +5,204 @@
'
use strict
'
;
import
{
IThemeRule
}
from
'
vs/editor/common/modes/supports/tokenization
'
;
/* -------------------------------- Begin vs tokens -------------------------------- */
export
const
vs
:
IThemeRule
[]
=
[
{
token
:
''
,
foreground
:
'
000000
'
,
background
:
'
fffffe
'
},
{
token
:
'
invalid
'
,
foreground
:
'
cd3131
'
},
{
token
:
'
emphasis
'
,
fontStyle
:
'
italic
'
},
{
token
:
'
strong
'
,
fontStyle
:
'
bold
'
},
{
token
:
'
variable
'
,
foreground
:
'
001188
'
},
{
token
:
'
variable.predefined
'
,
foreground
:
'
4864AA
'
},
{
token
:
'
constant
'
,
foreground
:
'
dd0000
'
},
{
token
:
'
comment
'
,
foreground
:
'
008000
'
},
{
token
:
'
number
'
,
foreground
:
'
09885A
'
},
{
token
:
'
number.hex
'
,
foreground
:
'
3030c0
'
},
{
token
:
'
regexp
'
,
foreground
:
'
800000
'
},
{
token
:
'
annotation
'
,
foreground
:
'
808080
'
},
{
token
:
'
type
'
,
foreground
:
'
008080
'
},
{
token
:
'
delimiter
'
,
foreground
:
'
000000
'
},
{
token
:
'
delimiter.html
'
,
foreground
:
'
383838
'
},
{
token
:
'
delimiter.xml
'
,
foreground
:
'
0000FF
'
},
{
token
:
'
tag
'
,
foreground
:
'
800000
'
},
{
token
:
'
tag.id.jade
'
,
foreground
:
'
4F76AC
'
},
{
token
:
'
tag.class.jade
'
,
foreground
:
'
4F76AC
'
},
{
token
:
'
meta.scss
'
,
foreground
:
'
800000
'
},
{
token
:
'
metatag
'
,
foreground
:
'
e00000
'
},
{
token
:
'
metatag.content.html
'
,
foreground
:
'
FF0000
'
},
{
token
:
'
metatag.html
'
,
foreground
:
'
808080
'
},
{
token
:
'
metatag.xml
'
,
foreground
:
'
808080
'
},
{
token
:
'
metatag.php
'
,
fontStyle
:
'
bold
'
},
{
token
:
'
key
'
,
foreground
:
'
863B00
'
},
{
token
:
'
string.key.json
'
,
foreground
:
'
A31515
'
},
{
token
:
'
string.value.json
'
,
foreground
:
'
0451A5
'
},
{
token
:
'
attribute.name
'
,
foreground
:
'
FF0000
'
},
{
token
:
'
attribute.value
'
,
foreground
:
'
0451A5
'
},
{
token
:
'
attribute.value.number
'
,
foreground
:
'
09885A
'
},
{
token
:
'
attribute.value.unit
'
,
foreground
:
'
09885A
'
},
{
token
:
'
attribute.value.html
'
,
foreground
:
'
0000FF
'
},
{
token
:
'
attribute.value.xml
'
,
foreground
:
'
0000FF
'
},
{
token
:
'
string
'
,
foreground
:
'
A31515
'
},
{
token
:
'
string.html
'
,
foreground
:
'
0000FF
'
},
{
token
:
'
string.sql
'
,
foreground
:
'
FF0000
'
},
{
token
:
'
string.yaml
'
,
foreground
:
'
0451A5
'
},
{
token
:
'
keyword
'
,
foreground
:
'
0000FF
'
},
{
token
:
'
keyword.json
'
,
foreground
:
'
0451A5
'
},
{
token
:
'
keyword.flow
'
,
foreground
:
'
AF00DB
'
},
{
token
:
'
keyword.flow.scss
'
,
foreground
:
'
0000FF
'
},
{
token
:
'
operator.scss
'
,
foreground
:
'
666666
'
},
{
token
:
'
operator.sql
'
,
foreground
:
'
778899
'
},
{
token
:
'
operator.swift
'
,
foreground
:
'
666666
'
},
{
token
:
'
predefined.sql
'
,
foreground
:
'
FF00FF
'
},
];
/* -------------------------------- End vs tokens -------------------------------- */
/* -------------------------------- Begin vs-dark tokens -------------------------------- */
export
const
vs_dark
:
IThemeRule
[]
=
[
{
token
:
''
,
foreground
:
'
D4D4D4
'
,
background
:
'
1E1E1E
'
},
{
token
:
'
invalid
'
,
foreground
:
'
f44747
'
},
{
token
:
'
emphasis
'
,
fontStyle
:
'
italic
'
},
{
token
:
'
strong
'
,
fontStyle
:
'
bold
'
},
{
token
:
'
variable
'
,
foreground
:
'
74B0DF
'
},
{
token
:
'
variable.predefined
'
,
foreground
:
'
4864AA
'
},
{
token
:
'
variable.parameter
'
,
foreground
:
'
9CDCFE
'
},
{
token
:
'
constant
'
,
foreground
:
'
569CD6
'
},
{
token
:
'
comment
'
,
foreground
:
'
608B4E
'
},
{
token
:
'
number
'
,
foreground
:
'
B5CEA8
'
},
{
token
:
'
number.hex
'
,
foreground
:
'
5BB498
'
},
{
token
:
'
regexp
'
,
foreground
:
'
B46695
'
},
{
token
:
'
annotation
'
,
foreground
:
'
cc6666
'
},
{
token
:
'
type
'
,
foreground
:
'
3DC9B0
'
},
{
token
:
'
delimiter
'
,
foreground
:
'
DCDCDC
'
},
{
token
:
'
delimiter.html
'
,
foreground
:
'
808080
'
},
{
token
:
'
delimiter.xml
'
,
foreground
:
'
808080
'
},
{
token
:
'
tag
'
,
foreground
:
'
569CD6
'
},
{
token
:
'
tag.id.jade
'
,
foreground
:
'
4F76AC
'
},
{
token
:
'
tag.class.jade
'
,
foreground
:
'
4F76AC
'
},
{
token
:
'
meta.scss
'
,
foreground
:
'
A79873
'
},
{
token
:
'
meta.tag
'
,
foreground
:
'
CE9178
'
},
{
token
:
'
metatag
'
,
foreground
:
'
DD6A6F
'
},
{
token
:
'
metatag.content.html
'
,
foreground
:
'
9CDCFE
'
},
{
token
:
'
metatag.html
'
,
foreground
:
'
569CD6
'
},
{
token
:
'
metatag.xml
'
,
foreground
:
'
569CD6
'
},
{
token
:
'
metatag.php
'
,
fontStyle
:
'
bold
'
},
{
token
:
'
key
'
,
foreground
:
'
9CDCFE
'
},
{
token
:
'
string.key.json
'
,
foreground
:
'
9CDCFE
'
},
{
token
:
'
string.value.json
'
,
foreground
:
'
CE9178
'
},
{
token
:
'
attribute.name
'
,
foreground
:
'
9CDCFE
'
},
{
token
:
'
attribute.value
'
,
foreground
:
'
CE9178
'
},
{
token
:
'
attribute.value.number.css
'
,
foreground
:
'
B5CEA8
'
},
{
token
:
'
attribute.value.unit.css
'
,
foreground
:
'
B5CEA8
'
},
{
token
:
'
attribute.value.hex.css
'
,
foreground
:
'
D4D4D4
'
},
{
token
:
'
string
'
,
foreground
:
'
CE9178
'
},
{
token
:
'
string.sql
'
,
foreground
:
'
FF0000
'
},
{
token
:
'
keyword
'
,
foreground
:
'
569CD6
'
},
{
token
:
'
keyword.flow
'
,
foreground
:
'
C586C0
'
},
{
token
:
'
keyword.json
'
,
foreground
:
'
CE9178
'
},
{
token
:
'
keyword.flow.scss
'
,
foreground
:
'
569CD6
'
},
{
token
:
'
operator.scss
'
,
foreground
:
'
909090
'
},
{
token
:
'
operator.sql
'
,
foreground
:
'
778899
'
},
{
token
:
'
operator.swift
'
,
foreground
:
'
909090
'
},
{
token
:
'
predefined.sql
'
,
foreground
:
'
FF00FF
'
},
];
/* -------------------------------- End vs-dark tokens -------------------------------- */
/* -------------------------------- Begin hc-black tokens -------------------------------- */
export
const
hc_black
:
IThemeRule
[]
=
[
{
token
:
''
,
foreground
:
'
FFFFFF
'
,
background
:
'
000000
'
},
{
token
:
'
invalid
'
,
foreground
:
'
f44747
'
},
{
token
:
'
emphasis
'
,
fontStyle
:
'
italic
'
},
{
token
:
'
strong
'
,
fontStyle
:
'
bold
'
},
{
token
:
'
variable
'
,
foreground
:
'
1AEBFF
'
},
{
token
:
'
variable.parameter
'
,
foreground
:
'
9CDCFE
'
},
{
token
:
'
constant
'
,
foreground
:
'
569CD6
'
},
{
token
:
'
comment
'
,
foreground
:
'
608B4E
'
},
{
token
:
'
number
'
,
foreground
:
'
FFFFFF
'
},
{
token
:
'
regexp
'
,
foreground
:
'
C0C0C0
'
},
{
token
:
'
annotation
'
,
foreground
:
'
569CD6
'
},
{
token
:
'
type
'
,
foreground
:
'
3DC9B0
'
},
{
token
:
'
delimiter
'
,
foreground
:
'
FFFF00
'
},
{
token
:
'
delimiter.html
'
,
foreground
:
'
FFFF00
'
},
{
token
:
'
tag
'
,
foreground
:
'
569CD6
'
},
{
token
:
'
tag.id.jade
'
,
foreground
:
'
4F76AC
'
},
{
token
:
'
tag.class.jade
'
,
foreground
:
'
4F76AC
'
},
{
token
:
'
meta
'
,
foreground
:
'
D4D4D4
'
},
{
token
:
'
meta.tag
'
,
foreground
:
'
CE9178
'
},
{
token
:
'
metatag
'
,
foreground
:
'
569CD6
'
},
{
token
:
'
metatag.content.html
'
,
foreground
:
'
1AEBFF
'
},
{
token
:
'
metatag.html
'
,
foreground
:
'
569CD6
'
},
{
token
:
'
metatag.xml
'
,
foreground
:
'
569CD6
'
},
{
token
:
'
metatag.php
'
,
fontStyle
:
'
bold
'
},
{
token
:
'
key
'
,
foreground
:
'
9CDCFE
'
},
{
token
:
'
string.key
'
,
foreground
:
'
9CDCFE
'
},
{
token
:
'
string.value
'
,
foreground
:
'
CE9178
'
},
{
token
:
'
attribute.name
'
,
foreground
:
'
569CD6
'
},
{
token
:
'
attribute.value
'
,
foreground
:
'
3FF23F
'
},
{
token
:
'
string
'
,
foreground
:
'
CE9178
'
},
{
token
:
'
string.sql
'
,
foreground
:
'
FF0000
'
},
{
token
:
'
keyword
'
,
foreground
:
'
569CD6
'
},
{
token
:
'
keyword.flow
'
,
foreground
:
'
C586C0
'
},
{
token
:
'
operator.sql
'
,
foreground
:
'
778899
'
},
{
token
:
'
operator.swift
'
,
foreground
:
'
909090
'
},
{
token
:
'
predefined.sql
'
,
foreground
:
'
FF00FF
'
},
];
/* -------------------------------- End hc-black tokens -------------------------------- */
import
{
IStandaloneThemeData
}
from
"
vs/editor/common/services/standaloneColorService
"
;
/* -------------------------------- Begin vs theme -------------------------------- */
export
const
vs
:
IStandaloneThemeData
=
{
base
:
'
vs
'
,
inherit
:
false
,
rules
:
[
{
token
:
''
,
foreground
:
'
000000
'
,
background
:
'
fffffe
'
},
{
token
:
'
invalid
'
,
foreground
:
'
cd3131
'
},
{
token
:
'
emphasis
'
,
fontStyle
:
'
italic
'
},
{
token
:
'
strong
'
,
fontStyle
:
'
bold
'
},
{
token
:
'
variable
'
,
foreground
:
'
001188
'
},
{
token
:
'
variable.predefined
'
,
foreground
:
'
4864AA
'
},
{
token
:
'
constant
'
,
foreground
:
'
dd0000
'
},
{
token
:
'
comment
'
,
foreground
:
'
008000
'
},
{
token
:
'
number
'
,
foreground
:
'
09885A
'
},
{
token
:
'
number.hex
'
,
foreground
:
'
3030c0
'
},
{
token
:
'
regexp
'
,
foreground
:
'
800000
'
},
{
token
:
'
annotation
'
,
foreground
:
'
808080
'
},
{
token
:
'
type
'
,
foreground
:
'
008080
'
},
{
token
:
'
delimiter
'
,
foreground
:
'
000000
'
},
{
token
:
'
delimiter.html
'
,
foreground
:
'
383838
'
},
{
token
:
'
delimiter.xml
'
,
foreground
:
'
0000FF
'
},
{
token
:
'
tag
'
,
foreground
:
'
800000
'
},
{
token
:
'
tag.id.jade
'
,
foreground
:
'
4F76AC
'
},
{
token
:
'
tag.class.jade
'
,
foreground
:
'
4F76AC
'
},
{
token
:
'
meta.scss
'
,
foreground
:
'
800000
'
},
{
token
:
'
metatag
'
,
foreground
:
'
e00000
'
},
{
token
:
'
metatag.content.html
'
,
foreground
:
'
FF0000
'
},
{
token
:
'
metatag.html
'
,
foreground
:
'
808080
'
},
{
token
:
'
metatag.xml
'
,
foreground
:
'
808080
'
},
{
token
:
'
metatag.php
'
,
fontStyle
:
'
bold
'
},
{
token
:
'
key
'
,
foreground
:
'
863B00
'
},
{
token
:
'
string.key.json
'
,
foreground
:
'
A31515
'
},
{
token
:
'
string.value.json
'
,
foreground
:
'
0451A5
'
},
{
token
:
'
attribute.name
'
,
foreground
:
'
FF0000
'
},
{
token
:
'
attribute.value
'
,
foreground
:
'
0451A5
'
},
{
token
:
'
attribute.value.number
'
,
foreground
:
'
09885A
'
},
{
token
:
'
attribute.value.unit
'
,
foreground
:
'
09885A
'
},
{
token
:
'
attribute.value.html
'
,
foreground
:
'
0000FF
'
},
{
token
:
'
attribute.value.xml
'
,
foreground
:
'
0000FF
'
},
{
token
:
'
string
'
,
foreground
:
'
A31515
'
},
{
token
:
'
string.html
'
,
foreground
:
'
0000FF
'
},
{
token
:
'
string.sql
'
,
foreground
:
'
FF0000
'
},
{
token
:
'
string.yaml
'
,
foreground
:
'
0451A5
'
},
{
token
:
'
keyword
'
,
foreground
:
'
0000FF
'
},
{
token
:
'
keyword.json
'
,
foreground
:
'
0451A5
'
},
{
token
:
'
keyword.flow
'
,
foreground
:
'
AF00DB
'
},
{
token
:
'
keyword.flow.scss
'
,
foreground
:
'
0000FF
'
},
{
token
:
'
operator.scss
'
,
foreground
:
'
666666
'
},
{
token
:
'
operator.sql
'
,
foreground
:
'
778899
'
},
{
token
:
'
operator.swift
'
,
foreground
:
'
666666
'
},
{
token
:
'
predefined.sql
'
,
foreground
:
'
FF00FF
'
},
],
colors
:
{
editorBackground
:
'
#FFFFFF
'
,
editorForeground
:
'
#000000
'
,
editorInactiveSelection
:
'
#E5EBF1
'
,
editorGuide
:
'
#D3D3D3
'
,
editorSelectionHighlightColor
:
'
#ADD6FF4D
'
}
};
/* -------------------------------- End vs theme -------------------------------- */
/* -------------------------------- Begin vs-dark theme -------------------------------- */
export
const
vs_dark
:
IStandaloneThemeData
=
{
base
:
'
vs-dark
'
,
inherit
:
false
,
rules
:
[
{
token
:
''
,
foreground
:
'
D4D4D4
'
,
background
:
'
1E1E1E
'
},
{
token
:
'
invalid
'
,
foreground
:
'
f44747
'
},
{
token
:
'
emphasis
'
,
fontStyle
:
'
italic
'
},
{
token
:
'
strong
'
,
fontStyle
:
'
bold
'
},
{
token
:
'
variable
'
,
foreground
:
'
74B0DF
'
},
{
token
:
'
variable.predefined
'
,
foreground
:
'
4864AA
'
},
{
token
:
'
variable.parameter
'
,
foreground
:
'
9CDCFE
'
},
{
token
:
'
constant
'
,
foreground
:
'
569CD6
'
},
{
token
:
'
comment
'
,
foreground
:
'
608B4E
'
},
{
token
:
'
number
'
,
foreground
:
'
B5CEA8
'
},
{
token
:
'
number.hex
'
,
foreground
:
'
5BB498
'
},
{
token
:
'
regexp
'
,
foreground
:
'
B46695
'
},
{
token
:
'
annotation
'
,
foreground
:
'
cc6666
'
},
{
token
:
'
type
'
,
foreground
:
'
3DC9B0
'
},
{
token
:
'
delimiter
'
,
foreground
:
'
DCDCDC
'
},
{
token
:
'
delimiter.html
'
,
foreground
:
'
808080
'
},
{
token
:
'
delimiter.xml
'
,
foreground
:
'
808080
'
},
{
token
:
'
tag
'
,
foreground
:
'
569CD6
'
},
{
token
:
'
tag.id.jade
'
,
foreground
:
'
4F76AC
'
},
{
token
:
'
tag.class.jade
'
,
foreground
:
'
4F76AC
'
},
{
token
:
'
meta.scss
'
,
foreground
:
'
A79873
'
},
{
token
:
'
meta.tag
'
,
foreground
:
'
CE9178
'
},
{
token
:
'
metatag
'
,
foreground
:
'
DD6A6F
'
},
{
token
:
'
metatag.content.html
'
,
foreground
:
'
9CDCFE
'
},
{
token
:
'
metatag.html
'
,
foreground
:
'
569CD6
'
},
{
token
:
'
metatag.xml
'
,
foreground
:
'
569CD6
'
},
{
token
:
'
metatag.php
'
,
fontStyle
:
'
bold
'
},
{
token
:
'
key
'
,
foreground
:
'
9CDCFE
'
},
{
token
:
'
string.key.json
'
,
foreground
:
'
9CDCFE
'
},
{
token
:
'
string.value.json
'
,
foreground
:
'
CE9178
'
},
{
token
:
'
attribute.name
'
,
foreground
:
'
9CDCFE
'
},
{
token
:
'
attribute.value
'
,
foreground
:
'
CE9178
'
},
{
token
:
'
attribute.value.number.css
'
,
foreground
:
'
B5CEA8
'
},
{
token
:
'
attribute.value.unit.css
'
,
foreground
:
'
B5CEA8
'
},
{
token
:
'
attribute.value.hex.css
'
,
foreground
:
'
D4D4D4
'
},
{
token
:
'
string
'
,
foreground
:
'
CE9178
'
},
{
token
:
'
string.sql
'
,
foreground
:
'
FF0000
'
},
{
token
:
'
keyword
'
,
foreground
:
'
569CD6
'
},
{
token
:
'
keyword.flow
'
,
foreground
:
'
C586C0
'
},
{
token
:
'
keyword.json
'
,
foreground
:
'
CE9178
'
},
{
token
:
'
keyword.flow.scss
'
,
foreground
:
'
569CD6
'
},
{
token
:
'
operator.scss
'
,
foreground
:
'
909090
'
},
{
token
:
'
operator.sql
'
,
foreground
:
'
778899
'
},
{
token
:
'
operator.swift
'
,
foreground
:
'
909090
'
},
{
token
:
'
predefined.sql
'
,
foreground
:
'
FF00FF
'
},
],
colors
:
{
editorBackground
:
'
#1E1E1E
'
,
editorForeground
:
'
#D4D4D4
'
,
editorInactiveSelection
:
'
#3A3D41
'
,
editorGuide
:
'
#404040
'
,
editorSelectionHighlightColor
:
'
#ADD6FF26
'
}
};
/* -------------------------------- End vs-dark theme -------------------------------- */
/* -------------------------------- Begin hc-black theme -------------------------------- */
export
const
hc_black
:
IStandaloneThemeData
=
{
base
:
'
hc-black
'
,
inherit
:
false
,
rules
:
[
{
token
:
''
,
foreground
:
'
FFFFFF
'
,
background
:
'
000000
'
},
{
token
:
'
invalid
'
,
foreground
:
'
f44747
'
},
{
token
:
'
emphasis
'
,
fontStyle
:
'
italic
'
},
{
token
:
'
strong
'
,
fontStyle
:
'
bold
'
},
{
token
:
'
variable
'
,
foreground
:
'
1AEBFF
'
},
{
token
:
'
variable.parameter
'
,
foreground
:
'
9CDCFE
'
},
{
token
:
'
constant
'
,
foreground
:
'
569CD6
'
},
{
token
:
'
comment
'
,
foreground
:
'
608B4E
'
},
{
token
:
'
number
'
,
foreground
:
'
FFFFFF
'
},
{
token
:
'
regexp
'
,
foreground
:
'
C0C0C0
'
},
{
token
:
'
annotation
'
,
foreground
:
'
569CD6
'
},
{
token
:
'
type
'
,
foreground
:
'
3DC9B0
'
},
{
token
:
'
delimiter
'
,
foreground
:
'
FFFF00
'
},
{
token
:
'
delimiter.html
'
,
foreground
:
'
FFFF00
'
},
{
token
:
'
tag
'
,
foreground
:
'
569CD6
'
},
{
token
:
'
tag.id.jade
'
,
foreground
:
'
4F76AC
'
},
{
token
:
'
tag.class.jade
'
,
foreground
:
'
4F76AC
'
},
{
token
:
'
meta
'
,
foreground
:
'
D4D4D4
'
},
{
token
:
'
meta.tag
'
,
foreground
:
'
CE9178
'
},
{
token
:
'
metatag
'
,
foreground
:
'
569CD6
'
},
{
token
:
'
metatag.content.html
'
,
foreground
:
'
1AEBFF
'
},
{
token
:
'
metatag.html
'
,
foreground
:
'
569CD6
'
},
{
token
:
'
metatag.xml
'
,
foreground
:
'
569CD6
'
},
{
token
:
'
metatag.php
'
,
fontStyle
:
'
bold
'
},
{
token
:
'
key
'
,
foreground
:
'
9CDCFE
'
},
{
token
:
'
string.key
'
,
foreground
:
'
9CDCFE
'
},
{
token
:
'
string.value
'
,
foreground
:
'
CE9178
'
},
{
token
:
'
attribute.name
'
,
foreground
:
'
569CD6
'
},
{
token
:
'
attribute.value
'
,
foreground
:
'
3FF23F
'
},
{
token
:
'
string
'
,
foreground
:
'
CE9178
'
},
{
token
:
'
string.sql
'
,
foreground
:
'
FF0000
'
},
{
token
:
'
keyword
'
,
foreground
:
'
569CD6
'
},
{
token
:
'
keyword.flow
'
,
foreground
:
'
C586C0
'
},
{
token
:
'
operator.sql
'
,
foreground
:
'
778899
'
},
{
token
:
'
operator.swift
'
,
foreground
:
'
909090
'
},
{
token
:
'
predefined.sql
'
,
foreground
:
'
FF00FF
'
},
],
colors
:
{
editorBackground
:
'
#000000
'
,
editorForeground
:
'
#FFFFFF
'
,
editorGuide
:
'
#FFFFFF
'
,
}
};
/* -------------------------------- End hc-black theme -------------------------------- */
src/vs/editor/test/common/modes/supports/tokenization.test.ts
浏览文件 @
99dafc38
...
...
@@ -5,13 +5,13 @@
'
use strict
'
;
import
*
as
assert
from
'
assert
'
;
import
{
strcmp
,
parseT
heme
,
Theme
,
Parsed
ThemeRule
,
ColorMap
,
ExternalThemeTrieElement
,
ThemeTrieElementRule
}
from
'
vs/editor/common/modes/supports/tokenization
'
;
import
{
strcmp
,
parseT
okenTheme
,
TokenTheme
,
ParsedToken
ThemeRule
,
ColorMap
,
ExternalThemeTrieElement
,
ThemeTrieElementRule
}
from
'
vs/editor/common/modes/supports/tokenization
'
;
import
{
FontStyle
}
from
'
vs/editor/common/modes
'
;
suite
(
'
Theme matching
'
,
()
=>
{
suite
(
'
T
oken t
heme matching
'
,
()
=>
{
test
(
'
gives higher priority to deeper matches
'
,
()
=>
{
let
theme
=
T
heme
.
createFromRaw
Theme
([
let
theme
=
T
okenTheme
.
createFromRawToken
Theme
([
{
token
:
''
,
foreground
:
'
100000
'
,
background
:
'
200000
'
},
{
token
:
'
punctuation.definition.string.begin.html
'
,
foreground
:
'
300000
'
},
{
token
:
'
punctuation.definition.string
'
,
foreground
:
'
400000
'
},
...
...
@@ -29,7 +29,7 @@ suite('Theme matching', () => {
});
test
(
'
can match
'
,
()
=>
{
let
theme
=
T
heme
.
createFromRaw
Theme
([
let
theme
=
T
okenTheme
.
createFromRawToken
Theme
([
{
token
:
''
,
foreground
:
'
F8F8F2
'
,
background
:
'
272822
'
},
{
token
:
'
source
'
,
background
:
'
100000
'
},
{
token
:
'
something
'
,
background
:
'
100000
'
},
...
...
@@ -121,11 +121,11 @@ suite('Theme matching', () => {
});
});
suite
(
'
Theme parsing
'
,
()
=>
{
suite
(
'
T
oken t
heme parsing
'
,
()
=>
{
test
(
'
can parse
'
,
()
=>
{
let
actual
=
parseTheme
([
let
actual
=
parseT
okenT
heme
([
{
token
:
''
,
foreground
:
'
F8F8F2
'
,
background
:
'
272822
'
},
{
token
:
'
source
'
,
background
:
'
100000
'
},
{
token
:
'
something
'
,
background
:
'
100000
'
},
...
...
@@ -140,24 +140,24 @@ suite('Theme parsing', () => {
]);
let
expected
=
[
new
ParsedThemeRule
(
''
,
0
,
FontStyle
.
NotSet
,
'
F8F8F2
'
,
'
272822
'
),
new
ParsedThemeRule
(
'
source
'
,
1
,
FontStyle
.
NotSet
,
null
,
'
100000
'
),
new
ParsedThemeRule
(
'
something
'
,
2
,
FontStyle
.
NotSet
,
null
,
'
100000
'
),
new
ParsedThemeRule
(
'
bar
'
,
3
,
FontStyle
.
NotSet
,
null
,
'
010000
'
),
new
ParsedThemeRule
(
'
baz
'
,
4
,
FontStyle
.
NotSet
,
null
,
'
010000
'
),
new
ParsedThemeRule
(
'
bar
'
,
5
,
FontStyle
.
Bold
,
null
,
null
),
new
ParsedThemeRule
(
'
constant
'
,
6
,
FontStyle
.
Italic
,
'
ff0000
'
,
null
),
new
ParsedThemeRule
(
'
constant.numeric
'
,
7
,
FontStyle
.
NotSet
,
'
00ff00
'
,
null
),
new
ParsedThemeRule
(
'
constant.numeric.hex
'
,
8
,
FontStyle
.
Bold
,
null
,
null
),
new
ParsedThemeRule
(
'
constant.numeric.oct
'
,
9
,
FontStyle
.
Bold
|
FontStyle
.
Italic
|
FontStyle
.
Underline
,
null
,
null
),
new
ParsedThemeRule
(
'
constant.numeric.dec
'
,
10
,
FontStyle
.
None
,
'
0000ff
'
,
null
),
new
ParsedT
okenT
hemeRule
(
''
,
0
,
FontStyle
.
NotSet
,
'
F8F8F2
'
,
'
272822
'
),
new
ParsedT
okenT
hemeRule
(
'
source
'
,
1
,
FontStyle
.
NotSet
,
null
,
'
100000
'
),
new
ParsedT
okenT
hemeRule
(
'
something
'
,
2
,
FontStyle
.
NotSet
,
null
,
'
100000
'
),
new
ParsedT
okenT
hemeRule
(
'
bar
'
,
3
,
FontStyle
.
NotSet
,
null
,
'
010000
'
),
new
ParsedT
okenT
hemeRule
(
'
baz
'
,
4
,
FontStyle
.
NotSet
,
null
,
'
010000
'
),
new
ParsedT
okenT
hemeRule
(
'
bar
'
,
5
,
FontStyle
.
Bold
,
null
,
null
),
new
ParsedT
okenT
hemeRule
(
'
constant
'
,
6
,
FontStyle
.
Italic
,
'
ff0000
'
,
null
),
new
ParsedT
okenT
hemeRule
(
'
constant.numeric
'
,
7
,
FontStyle
.
NotSet
,
'
00ff00
'
,
null
),
new
ParsedT
okenT
hemeRule
(
'
constant.numeric.hex
'
,
8
,
FontStyle
.
Bold
,
null
,
null
),
new
ParsedT
okenT
hemeRule
(
'
constant.numeric.oct
'
,
9
,
FontStyle
.
Bold
|
FontStyle
.
Italic
|
FontStyle
.
Underline
,
null
,
null
),
new
ParsedT
okenT
hemeRule
(
'
constant.numeric.dec
'
,
10
,
FontStyle
.
None
,
'
0000ff
'
,
null
),
];
assert
.
deepEqual
(
actual
,
expected
);
});
});
suite
(
'
Theme resolving
'
,
()
=>
{
suite
(
'
T
oken t
heme resolving
'
,
()
=>
{
test
(
'
strcmp works
'
,
()
=>
{
let
actual
=
[
'
bar
'
,
'
z
'
,
'
zu
'
,
'
a
'
,
'
ab
'
,
''
].
sort
(
strcmp
);
...
...
@@ -167,7 +167,7 @@ suite('Theme resolving', () => {
});
test
(
'
always has defaults
'
,
()
=>
{
let
actual
=
T
heme
.
createFromParsed
Theme
([]);
let
actual
=
T
okenTheme
.
createFromParsedToken
Theme
([]);
let
colorMap
=
new
ColorMap
();
const
_A
=
colorMap
.
getId
(
'
000000
'
);
const
_B
=
colorMap
.
getId
(
'
ffffff
'
);
...
...
@@ -176,8 +176,8 @@ suite('Theme resolving', () => {
});
test
(
'
respects incoming defaults 1
'
,
()
=>
{
let
actual
=
T
heme
.
createFromParsed
Theme
([
new
ParsedThemeRule
(
''
,
-
1
,
FontStyle
.
NotSet
,
null
,
null
)
let
actual
=
T
okenTheme
.
createFromParsedToken
Theme
([
new
ParsedT
okenT
hemeRule
(
''
,
-
1
,
FontStyle
.
NotSet
,
null
,
null
)
]);
let
colorMap
=
new
ColorMap
();
const
_A
=
colorMap
.
getId
(
'
000000
'
);
...
...
@@ -187,8 +187,8 @@ suite('Theme resolving', () => {
});
test
(
'
respects incoming defaults 2
'
,
()
=>
{
let
actual
=
T
heme
.
createFromParsed
Theme
([
new
ParsedThemeRule
(
''
,
-
1
,
FontStyle
.
None
,
null
,
null
)
let
actual
=
T
okenTheme
.
createFromParsedToken
Theme
([
new
ParsedT
okenT
hemeRule
(
''
,
-
1
,
FontStyle
.
None
,
null
,
null
)
]);
let
colorMap
=
new
ColorMap
();
const
_A
=
colorMap
.
getId
(
'
000000
'
);
...
...
@@ -198,8 +198,8 @@ suite('Theme resolving', () => {
});
test
(
'
respects incoming defaults 3
'
,
()
=>
{
let
actual
=
T
heme
.
createFromParsed
Theme
([
new
ParsedThemeRule
(
''
,
-
1
,
FontStyle
.
Bold
,
null
,
null
)
let
actual
=
T
okenTheme
.
createFromParsedToken
Theme
([
new
ParsedT
okenT
hemeRule
(
''
,
-
1
,
FontStyle
.
Bold
,
null
,
null
)
]);
let
colorMap
=
new
ColorMap
();
const
_A
=
colorMap
.
getId
(
'
000000
'
);
...
...
@@ -209,8 +209,8 @@ suite('Theme resolving', () => {
});
test
(
'
respects incoming defaults 4
'
,
()
=>
{
let
actual
=
T
heme
.
createFromParsed
Theme
([
new
ParsedThemeRule
(
''
,
-
1
,
FontStyle
.
NotSet
,
'
ff0000
'
,
null
)
let
actual
=
T
okenTheme
.
createFromParsedToken
Theme
([
new
ParsedT
okenT
hemeRule
(
''
,
-
1
,
FontStyle
.
NotSet
,
'
ff0000
'
,
null
)
]);
let
colorMap
=
new
ColorMap
();
const
_A
=
colorMap
.
getId
(
'
ff0000
'
);
...
...
@@ -220,8 +220,8 @@ suite('Theme resolving', () => {
});
test
(
'
respects incoming defaults 5
'
,
()
=>
{
let
actual
=
T
heme
.
createFromParsed
Theme
([
new
ParsedThemeRule
(
''
,
-
1
,
FontStyle
.
NotSet
,
null
,
'
ff0000
'
)
let
actual
=
T
okenTheme
.
createFromParsedToken
Theme
([
new
ParsedT
okenT
hemeRule
(
''
,
-
1
,
FontStyle
.
NotSet
,
null
,
'
ff0000
'
)
]);
let
colorMap
=
new
ColorMap
();
const
_A
=
colorMap
.
getId
(
'
000000
'
);
...
...
@@ -231,10 +231,10 @@ suite('Theme resolving', () => {
});
test
(
'
can merge incoming defaults
'
,
()
=>
{
let
actual
=
T
heme
.
createFromParsed
Theme
([
new
ParsedThemeRule
(
''
,
-
1
,
FontStyle
.
NotSet
,
null
,
'
ff0000
'
),
new
ParsedThemeRule
(
''
,
-
1
,
FontStyle
.
NotSet
,
'
00ff00
'
,
null
),
new
ParsedThemeRule
(
''
,
-
1
,
FontStyle
.
Bold
,
null
,
null
),
let
actual
=
T
okenTheme
.
createFromParsedToken
Theme
([
new
ParsedT
okenT
hemeRule
(
''
,
-
1
,
FontStyle
.
NotSet
,
null
,
'
ff0000
'
),
new
ParsedT
okenT
hemeRule
(
''
,
-
1
,
FontStyle
.
NotSet
,
'
00ff00
'
,
null
),
new
ParsedT
okenT
hemeRule
(
''
,
-
1
,
FontStyle
.
Bold
,
null
,
null
),
]);
let
colorMap
=
new
ColorMap
();
const
_A
=
colorMap
.
getId
(
'
00ff00
'
);
...
...
@@ -244,9 +244,9 @@ suite('Theme resolving', () => {
});
test
(
'
defaults are inherited
'
,
()
=>
{
let
actual
=
T
heme
.
createFromParsed
Theme
([
new
ParsedThemeRule
(
''
,
-
1
,
FontStyle
.
NotSet
,
'
F8F8F2
'
,
'
272822
'
),
new
ParsedThemeRule
(
'
var
'
,
-
1
,
FontStyle
.
NotSet
,
'
ff0000
'
,
null
)
let
actual
=
T
okenTheme
.
createFromParsedToken
Theme
([
new
ParsedT
okenT
hemeRule
(
''
,
-
1
,
FontStyle
.
NotSet
,
'
F8F8F2
'
,
'
272822
'
),
new
ParsedT
okenT
hemeRule
(
'
var
'
,
-
1
,
FontStyle
.
NotSet
,
'
ff0000
'
,
null
)
]);
let
colorMap
=
new
ColorMap
();
const
_A
=
colorMap
.
getId
(
'
F8F8F2
'
);
...
...
@@ -260,10 +260,10 @@ suite('Theme resolving', () => {
});
test
(
'
same rules get merged
'
,
()
=>
{
let
actual
=
T
heme
.
createFromParsed
Theme
([
new
ParsedThemeRule
(
''
,
-
1
,
FontStyle
.
NotSet
,
'
F8F8F2
'
,
'
272822
'
),
new
ParsedThemeRule
(
'
var
'
,
1
,
FontStyle
.
Bold
,
null
,
null
),
new
ParsedThemeRule
(
'
var
'
,
0
,
FontStyle
.
NotSet
,
'
ff0000
'
,
null
),
let
actual
=
T
okenTheme
.
createFromParsedToken
Theme
([
new
ParsedT
okenT
hemeRule
(
''
,
-
1
,
FontStyle
.
NotSet
,
'
F8F8F2
'
,
'
272822
'
),
new
ParsedT
okenT
hemeRule
(
'
var
'
,
1
,
FontStyle
.
Bold
,
null
,
null
),
new
ParsedT
okenT
hemeRule
(
'
var
'
,
0
,
FontStyle
.
NotSet
,
'
ff0000
'
,
null
),
]);
let
colorMap
=
new
ColorMap
();
const
_A
=
colorMap
.
getId
(
'
F8F8F2
'
);
...
...
@@ -277,10 +277,10 @@ suite('Theme resolving', () => {
});
test
(
'
rules are inherited 1
'
,
()
=>
{
let
actual
=
T
heme
.
createFromParsed
Theme
([
new
ParsedThemeRule
(
''
,
-
1
,
FontStyle
.
NotSet
,
'
F8F8F2
'
,
'
272822
'
),
new
ParsedThemeRule
(
'
var
'
,
-
1
,
FontStyle
.
Bold
,
'
ff0000
'
,
null
),
new
ParsedThemeRule
(
'
var.identifier
'
,
-
1
,
FontStyle
.
NotSet
,
'
00ff00
'
,
null
),
let
actual
=
T
okenTheme
.
createFromParsedToken
Theme
([
new
ParsedT
okenT
hemeRule
(
''
,
-
1
,
FontStyle
.
NotSet
,
'
F8F8F2
'
,
'
272822
'
),
new
ParsedT
okenT
hemeRule
(
'
var
'
,
-
1
,
FontStyle
.
Bold
,
'
ff0000
'
,
null
),
new
ParsedT
okenT
hemeRule
(
'
var.identifier
'
,
-
1
,
FontStyle
.
NotSet
,
'
00ff00
'
,
null
),
]);
let
colorMap
=
new
ColorMap
();
const
_A
=
colorMap
.
getId
(
'
F8F8F2
'
);
...
...
@@ -297,15 +297,15 @@ suite('Theme resolving', () => {
});
test
(
'
rules are inherited 2
'
,
()
=>
{
let
actual
=
T
heme
.
createFromParsed
Theme
([
new
ParsedThemeRule
(
''
,
-
1
,
FontStyle
.
NotSet
,
'
F8F8F2
'
,
'
272822
'
),
new
ParsedThemeRule
(
'
var
'
,
-
1
,
FontStyle
.
Bold
,
'
ff0000
'
,
null
),
new
ParsedThemeRule
(
'
var.identifier
'
,
-
1
,
FontStyle
.
NotSet
,
'
00ff00
'
,
null
),
new
ParsedThemeRule
(
'
constant
'
,
4
,
FontStyle
.
Italic
,
'
100000
'
,
null
),
new
ParsedThemeRule
(
'
constant.numeric
'
,
5
,
FontStyle
.
NotSet
,
'
200000
'
,
null
),
new
ParsedThemeRule
(
'
constant.numeric.hex
'
,
6
,
FontStyle
.
Bold
,
null
,
null
),
new
ParsedThemeRule
(
'
constant.numeric.oct
'
,
7
,
FontStyle
.
Bold
|
FontStyle
.
Italic
|
FontStyle
.
Underline
,
null
,
null
),
new
ParsedThemeRule
(
'
constant.numeric.dec
'
,
8
,
FontStyle
.
None
,
'
300000
'
,
null
),
let
actual
=
T
okenTheme
.
createFromParsedToken
Theme
([
new
ParsedT
okenT
hemeRule
(
''
,
-
1
,
FontStyle
.
NotSet
,
'
F8F8F2
'
,
'
272822
'
),
new
ParsedT
okenT
hemeRule
(
'
var
'
,
-
1
,
FontStyle
.
Bold
,
'
ff0000
'
,
null
),
new
ParsedT
okenT
hemeRule
(
'
var.identifier
'
,
-
1
,
FontStyle
.
NotSet
,
'
00ff00
'
,
null
),
new
ParsedT
okenT
hemeRule
(
'
constant
'
,
4
,
FontStyle
.
Italic
,
'
100000
'
,
null
),
new
ParsedT
okenT
hemeRule
(
'
constant.numeric
'
,
5
,
FontStyle
.
NotSet
,
'
200000
'
,
null
),
new
ParsedT
okenT
hemeRule
(
'
constant.numeric.hex
'
,
6
,
FontStyle
.
Bold
,
null
,
null
),
new
ParsedT
okenT
hemeRule
(
'
constant.numeric.oct
'
,
7
,
FontStyle
.
Bold
|
FontStyle
.
Italic
|
FontStyle
.
Underline
,
null
,
null
),
new
ParsedT
okenT
hemeRule
(
'
constant.numeric.dec
'
,
8
,
FontStyle
.
None
,
'
300000
'
,
null
),
]);
let
colorMap
=
new
ColorMap
();
const
_A
=
colorMap
.
getId
(
'
F8F8F2
'
);
...
...
src/vs/monaco.d.ts
浏览文件 @
99dafc38
...
...
@@ -875,17 +875,22 @@ declare module monaco.editor {
/**
* Define a new theme.
*/
export
function
defineTheme
(
themeName
:
string
,
themeData
:
I
Theme
):
void
;
export
function
defineTheme
(
themeName
:
string
,
themeData
:
I
StandaloneThemeData
):
void
;
export
type
BuiltinTheme
=
'
vs
'
|
'
vs-dark
'
|
'
hc-black
'
;
export
interface
I
Theme
{
export
interface
I
StandaloneThemeData
{
base
:
BuiltinTheme
;
inherit
:
boolean
;
rules
:
IThemeRule
[];
rules
:
ITokenThemeRule
[];
colors
:
IColors
;
}
export
interface
IThemeRule
{
export
type
IColors
=
{
[
colorId
:
string
]:
string
;
};
export
interface
ITokenThemeRule
{
token
:
string
;
foreground
?:
string
;
background
?:
string
;
...
...
src/vs/platform/theme/common/themeService.ts
浏览文件 @
99dafc38
...
...
@@ -19,7 +19,6 @@ export type ThemeType = 'light' | 'dark' | 'hc';
export
interface
ITheme
{
readonly
selector
:
string
;
readonly
label
:
string
;
readonly
type
:
ThemeType
;
/**
...
...
src/vs/workbench/test/workbenchTestServices.ts
浏览文件 @
99dafc38
...
...
@@ -984,7 +984,6 @@ export class TestWindowsService implements IWindowsService {
export
class
TestTheme
implements
ITheme
{
selector
:
string
;
label
:
string
;
type
:
'
light
'
|
'
dark
'
|
'
hc
'
;
getColor
(
color
:
string
,
useDefault
?:
boolean
):
Color
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录