【发布时间】:2021-06-14 15:02:40
【问题描述】:
我想自定义 cmets 或关键字的颜色(不确定它们叫什么,但我已经在附图中描述了它们。)。那么如何在 vs 代码中使用“editor.tokenColorCustomizations”更改它们的颜色。(红色的代码必须改。)
【问题讨论】:
标签: visual-studio-code vscode-settings
我想自定义 cmets 或关键字的颜色(不确定它们叫什么,但我已经在附图中描述了它们。)。那么如何在 vs 代码中使用“editor.tokenColorCustomizations”更改它们的颜色。(红色的代码必须改。)
【问题讨论】:
标签: visual-studio-code vscode-settings
使用命令面板中的Scopes Inspector,单击这些 json 键,您将看到它们的作用域。在您的settings.json 中可以这样使用:
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "support.type.property-name.json.comments",
"settings": {
"foreground": "#00ff00",
"fontStyle": "bold",
}
}
]
}
如果您想将上述更改限制为特定颜色主题,请使用此表单:
```jsonc
"editor.tokenColorCustomizations": {
"[Monokai Classic]": { // your theme name here
"textMateRules": [
{
"scope": "support.type.property-name.json.comments",
"settings": {
"foreground": "#00ff00",
"fontStyle": "bold",
}
}
]
}
}
【讨论】: