正如其他人所说,您需要覆盖editor.tokenColorCustomizations
或workbench.colorCustomizations
settings.json文件中设置。在这里,您可以选择一个基本主题(例如Abyss),并且仅覆盖您要更改的内容。您可以非常轻松地覆盖函数,字符串颜色等很少的内容。
例如 workbench.colorCustomizations
"workbench.colorCustomizations": {
"[Default Dark+]": {
"editor.background": "#130e293f",
}
}
例如editor.tokenColorCustomizations
:
"editor.tokenColorCustomizations": {
"[Abyss]": {
"functions": "#FF0000",
"strings": "#FF0000"
}
}
但是,深度自定义(如更改var
关键字的颜色)将要求您在textMateRules
键。
例如:
"editor.tokenColorCustomizations": {
"[Abyss]": {
"textMateRules": [
{
"scope": "keyword.operator",
"settings": {
"foreground": "#FFFFFF"
}
},
{
"scope": "keyword.var",
"settings": {
"foreground": "#2871bb",
"fontStyle": "bold"
}
}
]
}
}
您还可以跨主题全局覆盖:
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": [
"comment",
"entity.name.type.class",
"keyword",
"storage.modifier",
"storage.type.class.js",
"storage.type.function.js",
"storage.type.js",
"keyword.control.import.js",
"keyword.control.from.js",
"keyword.control.flow.js",
"keyword.control.conditional.js",
"keyword.control.loop.js",
"keyword.operator.new.js",
],
"settings": {
"fontStyle": "italic"
}
}
]
}
此处有更多详细信息:https : //code.visualstudio.com/api/language-extensions/syntax-highlight-guide
workbench.colorCustomizations
和editor.tokenColorCustomizations
在用户设置中修改所有内容:code.visualstudio.com/docs/getstarted/…。