有的小伙伴习惯用淡绿色作为背景,虽说实际上没有护眼的效果,但是看起来眼睛还是比较舒服的。我们来看一下在VS Code中如何更换代码区的背景色。
具体步骤
- 找到主题所在路径
VS Code Theme所在路径是:安装路径/resources/app/extensions
进入目录,滚动条拉到最下面,可以看到theme开头的文件夹,这些就是主题相关文件存放的位置了
- 修改当前使用的主题对应的json文件
我使用的是默认主题中的Light(Visual Studio)
对应的文件是:/theme-defaults/themes/light_defaults.json
内容如下:
{
"$schema": "vscode://schemas/color-theme",
"name": "Light Default Colors",
"colors": {
"editor.background": "#FFFFFF",
"editor.foreground": "#000000",
"editor.inactiveSelectionBackground": "#E5EBF1",
"editorIndentGuide.background": "#D3D3D3",
"editorIndentGuide.activeBackground": "#939393",
"editor.selectionHighlightBackground": "#ADD6FF80",
"editorSuggestWidget.background": "#F3F3F3",
"activityBarBadge.background": "#007ACC",
"sideBarTitle.foreground": "#6F6F6F",
"list.hoverBackground": "#E8E8E8",
"input.placeholderForeground": "#767676",
"settings.textInputBorder": "#CECECE",
"settings.numberInputBorder": "#CECECE",
"statusBarItem.remoteForeground": "#FFF",
"statusBarItem.remoteBackground": "#16825D"
}
}
可以看到editor.background
项的值是白色#FFFFFF
,果断改成淡绿色:
"editor.background": "#CCEED0",
改完重启VS Code即可