Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
8c5bdcdf
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,发现更多精彩内容 >>
提交
8c5bdcdf
编写于
8月 24, 2020
作者:
M
Martin Aeschlimann
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
web: API to prevent initial theme flickering (also fixes #101226)
上级
f3ac25fd
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
40 addition
and
34 deletion
+40
-34
src/vs/code/electron-browser/workbench/workbench.js
src/vs/code/electron-browser/workbench/workbench.js
+1
-6
src/vs/platform/windows/common/windows.ts
src/vs/platform/windows/common/windows.ts
+0
-2
src/vs/workbench/services/environment/browser/environmentService.ts
...kbench/services/environment/browser/environmentService.ts
+0
-5
src/vs/workbench/services/themes/browser/workbenchThemeService.ts
...orkbench/services/themes/browser/workbenchThemeService.ts
+9
-3
src/vs/workbench/services/themes/common/colorThemeData.ts
src/vs/workbench/services/themes/common/colorThemeData.ts
+8
-3
src/vs/workbench/services/themes/common/themeConfiguration.ts
...vs/workbench/services/themes/common/themeConfiguration.ts
+4
-15
src/vs/workbench/workbench.web.api.ts
src/vs/workbench/workbench.web.api.ts
+18
-0
未找到文件。
src/vs/code/electron-browser/workbench/workbench.js
浏览文件 @
8c5bdcdf
...
...
@@ -79,7 +79,6 @@ bootstrapWindow.load([
* @param {{
* partsSplashPath?: string,
* highContrast?: boolean,
* defaultThemeType?: string,
* extensionDevelopmentPath?: string[],
* folderUri?: object,
* workspace?: object
...
...
@@ -113,14 +112,10 @@ function showPartsSplash(configuration) {
baseTheme
=
data
.
baseTheme
;
shellBackground
=
data
.
colorInfo
.
editorBackground
;
shellForeground
=
data
.
colorInfo
.
foreground
;
}
else
if
(
configuration
.
highContrast
||
configuration
.
defaultThemeType
===
'
hc
'
)
{
}
else
if
(
configuration
.
highContrast
)
{
baseTheme
=
'
hc-black
'
;
shellBackground
=
'
#000000
'
;
shellForeground
=
'
#FFFFFF
'
;
}
else
if
(
configuration
.
defaultThemeType
===
'
vs
'
)
{
baseTheme
=
'
vs
'
;
shellBackground
=
'
#FFFFFF
'
;
shellForeground
=
'
#000000
'
;
}
else
{
baseTheme
=
'
vs-dark
'
;
shellBackground
=
'
#1E1E1E
'
;
...
...
src/vs/platform/windows/common/windows.ts
浏览文件 @
8c5bdcdf
...
...
@@ -7,7 +7,6 @@ import { isMacintosh, isLinux, isWeb } from 'vs/base/common/platform';
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
URI
,
UriComponents
}
from
'
vs/base/common/uri
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
ThemeType
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
IWorkspaceIdentifier
,
ISingleFolderWorkspaceIdentifier
}
from
'
vs/platform/workspaces/common/workspaces
'
;
export
interface
IBaseOpenWindowsOptions
{
...
...
@@ -182,7 +181,6 @@ export interface IWindowConfiguration {
remoteAuthority
?:
string
;
highContrast
?:
boolean
;
defaultThemeType
?:
ThemeType
;
filesToOpenOrCreate
?:
IPath
[];
filesToDiff
?:
IPath
[];
...
...
src/vs/workbench/services/environment/browser/environmentService.ts
浏览文件 @
8c5bdcdf
...
...
@@ -14,7 +14,6 @@ import { IWorkbenchConstructionOptions } from 'vs/workbench/workbench.web.api';
import
product
from
'
vs/platform/product/common/product
'
;
import
{
memoize
}
from
'
vs/base/common/decorators
'
;
import
{
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
import
{
LIGHT
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
parseLineAndColumnAware
}
from
'
vs/base/common/extpath
'
;
export
class
BrowserEnvironmentConfiguration
implements
IEnvironmentConfiguration
{
...
...
@@ -78,10 +77,6 @@ export class BrowserEnvironmentConfiguration implements IEnvironmentConfiguratio
get
highContrast
()
{
return
false
;
// could investigate to detect high contrast theme automatically
}
get
defaultThemeType
()
{
return
LIGHT
;
}
}
interface
IBrowserWorkbenchEnvironmentConstructionOptions
extends
IWorkbenchConstructionOptions
{
...
...
src/vs/workbench/services/themes/browser/workbenchThemeService.ts
浏览文件 @
8c5bdcdf
...
...
@@ -33,6 +33,7 @@ import { updateColorThemeConfigurationSchemas, updateFileIconThemeConfigurationS
import
{
ProductIconThemeData
,
DEFAULT_PRODUCT_ICON_THEME_ID
}
from
'
vs/workbench/services/themes/browser/productIconThemeData
'
;
import
{
registerProductIconThemeSchemas
}
from
'
vs/workbench/services/themes/common/productIconThemeSchema
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
isWeb
}
from
'
vs/base/common/platform
'
;
// implementation
...
...
@@ -102,8 +103,7 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
@
ILogService
private
readonly
logService
:
ILogService
)
{
this
.
container
=
layoutService
.
container
;
const
defaultThemeType
=
environmentService
.
configuration
.
defaultThemeType
||
DARK
;
this
.
settings
=
new
ThemeConfiguration
(
configurationService
,
defaultThemeType
);
this
.
settings
=
new
ThemeConfiguration
(
configurationService
);
this
.
colorThemeRegistry
=
new
ThemeRegistry
(
extensionService
,
colorThemesExtPoint
,
ColorThemeData
.
fromExtensionTheme
);
this
.
colorThemeWatcher
=
new
ThemeFileWatcher
(
fileService
,
environmentService
,
this
.
reloadCurrentColorTheme
.
bind
(
this
));
...
...
@@ -128,7 +128,13 @@ export class WorkbenchThemeService implements IWorkbenchThemeService {
themeData
=
ColorThemeData
.
createUnloadedThemeForThemeType
(
HIGH_CONTRAST
);
}
if
(
!
themeData
)
{
themeData
=
ColorThemeData
.
createUnloadedThemeForThemeType
(
defaultThemeType
);
const
initialColorTheme
=
environmentService
.
options
?.
initialColorTheme
;
if
(
initialColorTheme
)
{
themeData
=
ColorThemeData
.
createUnloadedThemeForThemeType
(
initialColorTheme
.
themeType
,
initialColorTheme
.
colors
);
}
}
if
(
!
themeData
)
{
themeData
=
ColorThemeData
.
createUnloadedThemeForThemeType
(
isWeb
?
LIGHT
:
DARK
);
}
themeData
.
setCustomizations
(
this
.
settings
);
this
.
applyTheme
(
themeData
,
undefined
,
true
);
...
...
src/vs/workbench/services/themes/common/colorThemeData.ts
浏览文件 @
8c5bdcdf
...
...
@@ -550,15 +550,20 @@ export class ColorThemeData implements IWorkbenchColorTheme {
// constructors
static
createUnloadedThemeForThemeType
(
themeType
:
ThemeType
):
ColorThemeData
{
return
ColorThemeData
.
createUnloadedTheme
(
getThemeTypeSelector
(
themeType
));
static
createUnloadedThemeForThemeType
(
themeType
:
ThemeType
,
colorMap
?:
{
[
id
:
string
]:
string
}
):
ColorThemeData
{
return
ColorThemeData
.
createUnloadedTheme
(
getThemeTypeSelector
(
themeType
)
,
colorMap
);
}
static
createUnloadedTheme
(
id
:
string
):
ColorThemeData
{
static
createUnloadedTheme
(
id
:
string
,
colorMap
?:
{
[
id
:
string
]:
string
}
):
ColorThemeData
{
let
themeData
=
new
ColorThemeData
(
id
,
''
,
'
__
'
+
id
);
themeData
.
isLoaded
=
false
;
themeData
.
themeTokenColors
=
[];
themeData
.
watch
=
false
;
if
(
colorMap
)
{
for
(
let
id
in
colorMap
)
{
themeData
.
colorMap
[
id
]
=
Color
.
fromHex
(
colorMap
[
id
]);
}
}
return
themeData
;
}
...
...
src/vs/workbench/services/themes/common/themeConfiguration.ts
浏览文件 @
8c5bdcdf
...
...
@@ -14,7 +14,7 @@ import { workbenchColorsSchemaId } from 'vs/platform/theme/common/colorRegistry'
import
{
tokenStylingSchemaId
}
from
'
vs/platform/theme/common/tokenClassificationRegistry
'
;
import
{
ThemeSettings
,
IWorkbenchColorTheme
,
IWorkbenchFileIconTheme
,
IColorCustomizations
,
ITokenColorCustomizations
,
IWorkbenchProductIconTheme
,
ISemanticTokenColorCustomizations
,
IExperimentalSemanticTokenColorCustomizations
}
from
'
vs/workbench/services/themes/common/workbenchThemeService
'
;
import
{
IConfigurationService
,
ConfigurationTarget
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
ThemeType
,
HIGH_CONTRAST
,
LIGHT
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
isWeb
}
from
'
vs/base/common/platform
'
;
const
DEFAULT_THEME_DARK_SETTING_VALUE
=
'
Default Dark+
'
;
const
DEFAULT_THEME_LIGHT_SETTING_VALUE
=
'
Default Light+
'
;
...
...
@@ -33,7 +33,7 @@ const colorThemeSettingEnumDescriptions: string[] = [];
const
colorThemeSettingSchema
:
IConfigurationPropertySchema
=
{
type
:
'
string
'
,
description
:
nls
.
localize
(
'
colorTheme
'
,
"
Specifies the color theme used in the workbench.
"
),
default
:
DEFAULT_THEME_DARK_SETTING_VALUE
,
default
:
isWeb
?
DEFAULT_THEME_LIGHT_SETTING_VALUE
:
DEFAULT_THEME_DARK_SETTING_VALUE
,
enum
:
colorThemeSettingEnum
,
enumDescriptions
:
colorThemeSettingEnumDescriptions
,
errorMessage
:
nls
.
localize
(
'
colorThemeError
'
,
"
Theme is unknown or not installed.
"
),
...
...
@@ -110,6 +110,7 @@ const themeSettingsConfiguration: IConfigurationNode = {
[
ThemeSettings
.
PRODUCT_ICON_THEME
]:
productIconThemeSettingSchema
}
};
configurationRegistry
.
registerConfiguration
(
themeSettingsConfiguration
);
function
tokenGroupSettings
(
description
:
string
):
IJSONSchema
{
return
{
...
...
@@ -231,19 +232,7 @@ export function updateProductIconThemeConfigurationSchemas(themes: IWorkbenchPro
export
class
ThemeConfiguration
{
constructor
(
private
configurationService
:
IConfigurationService
,
themeType
:
ThemeType
)
{
switch
(
themeType
)
{
case
LIGHT
:
colorThemeSettingSchema
.
default
=
DEFAULT_THEME_LIGHT_SETTING_VALUE
;
break
;
case
HIGH_CONTRAST
:
colorThemeSettingSchema
.
default
=
DEFAULT_THEME_HC_SETTING_VALUE
;
break
;
default
:
colorThemeSettingSchema
.
default
=
DEFAULT_THEME_DARK_SETTING_VALUE
;
break
;
}
configurationRegistry
.
registerConfiguration
(
themeSettingsConfiguration
);
constructor
(
private
configurationService
:
IConfigurationService
)
{
}
public
get
colorTheme
():
string
{
...
...
src/vs/workbench/workbench.web.api.ts
浏览文件 @
8c5bdcdf
...
...
@@ -147,6 +147,15 @@ interface IWindowIndicator {
command
?:
string
;
}
interface
IInitialColorTheme
{
themeType
:
'
light
'
|
'
dark
'
|
'
hc
'
;
/**
* a list of workbench colors
*/
colors
?:
{
[
colorId
:
string
]:
string
};
}
interface
IDefaultSideBarLayout
{
visible
?:
boolean
;
containers
?:
({
...
...
@@ -381,6 +390,15 @@ interface IWorkbenchConstructionOptions {
*/
readonly
windowIndicator
?:
IWindowIndicator
;
/**
* Specifies the default theme type (LIGHT, DARK..) and allows to provide initial colors that are shown
* until the color theme that is specified in the settings (`editor.colorTheme`) is loaded and applied.
* Once there are persisted colors from a last run these will be used.
*
* The idea is that the colors match the main colors from the theme defined in the `configurationDefaults`.
*/
readonly
initialColorTheme
?:
IInitialColorTheme
;
//#endregion
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录