我查看了 https://code.visualstudio.com/docs/getstarted/theme-color-reference,但似乎找不到改变评论颜色的设置。
我目前正在使用 Atom One Dark Theme,只是想把颜色变淡一点,这样我可以更好地阅读它。
看起来象征性的颜色目前无法在设置中自定义:
最突出的编辑器颜色是基于 语法上安装。这些颜色由 颜色主题和可以(目前)不能在设置中自定义。
资料来源: https://code.visualstudio.com/docs/getstarted/theme-color-reference
我确实注意到,如果你进入主题文件夹,例如: 程序文件(x86) Microsoft VS 代码资源应用程序扩展主题-monokai 编辑单色主题。Json 文件中,查找带有“ name”的行: “ comments”并更改“ foreground”颜色。一定要重启程序。
从 1.15(二零一七年七月)你可以改变它从 设置 json Ctrl + ,
"editor.tokenColorCustomizations": { "comments": "#d4922f" },
从 1.20(2018年1月)你也可以为每个主题单独做:
"editor.tokenColorCustomizations": { "[Atom One Dark]": { "comments": "#d4922f" } },
或者现在可以将多个主题的设置一次指定为 "[Atom One Dark][Tomorrow Night Blue]": {...}
"[Atom One Dark][Tomorrow Night Blue]": {...}
开发人员: 检查 TM 范围 editor.action.inspectTMScopes
editor.action.inspectTMScopes
选择优先次序:
Https://code.visualstudio.com/blogs/2017/02/08/syntax-highlighting-optimizations#_textmate-themes
好的,更多的例子(对于 js) :
js
"editor.tokenColorCustomizations": { "textMateRules": [{ "scope": "INSERT_SCOPE_HERE", "settings": { "foreground": "#ff0000" } }] }
comment < a href = “ https://i.stack.imgur.com/yzKfW.png”rel = “ noReferrer”> < img src = “ https://i.stack.imgur.com/yzKfW.png”alt = “ enter image description here”/> punctuation.definition.comment comment.block.documentation storage.type.class.jsdoc entity.name.type.instance.jsdoc variable.other.jsdoc < img src = “ https://i.stack.imgur.com/EpZO6.png”alt = “ enter image description here”/> < img src = “ https://i.stack.imgur.com/EpZO6.png”alt = “在这里输入图像描述”/>
comment
punctuation.definition.comment
comment.block.documentation
storage.type.class.jsdoc
entity.name.type.instance.jsdoc
variable.other.jsdoc
要详细说明答案和@Johnny Derp 的评论,可以使用以下方法更改字体颜色和样式:
"editor.tokenColorCustomizations": { "textMateRules": [ { "scope": "comment", "settings": { "fontStyle": "italic", "foreground": "#C69650", } } ] },
background不能以这种方式改变,只能改变颜色和样式。截至2018年6月。
background
同样是为了回应一些关于改变评论 puntuation(像 //)颜色的评论——现在必须用他们自己的文本同伴规则单独着色,在2019年10月发布的版本中可能会有一个改变来解决这个问题——在这一点上这是一个未解决的问题,但是增加到2019年10月的里程碑。见 https://github.com/microsoft/vscode/milestone/102
puntuation
//
1. 进入设置。
在搜索栏中输入“ Edit or.tokenColorCustomations”,然后点击“ Edit in setings.json”:
默认情况下,“ edit or.tokenColorCustomations”设置为“ null”。要自定义注释颜色,可以添加:
{“注释”: “[颜色代码]”}
你可以这样输入:
> "editor.tokenColorCustomizations": { > "comments": "#e45e91" },
4. 根据你的喜好,改变评论的颜色,将鼠标悬停在评论的颜色上,选择你想要的颜色。 5. 然后保存更改。(Ctrl + S)
退出程序。再打开它,你会看到修改。
更改 VS 代码注释颜色
文件-> 首选项-> 设置
选择“ Workspace Settings”选项卡,只为此项目更改它 选择“用户设置”选项卡为所有项目更改它
搜索“ setings.json”并查找“ Edit in setings.json”选项
在花括号中插入这个颜色设置:
“ edor.tokenColorCustomations”: { “评论”: “ # ff4” } < br/>
它可能会抱怨您正在覆盖当前的颜色主题,忽略它。
如果已经有一个“ edit or.tokenColorCustomations”部分,那么只需添加一行来指定注释颜色。
就像马克说的,但是在 "comment"之后加入 "scope":
"comment"
"scope":
“标点符号定义注释”
标点符号也要上色,
例如(javescript 中的 // | css 中的 /* */ | html 中的 <!-- -->)。
/* */
<!-- -->
"scope": ["comment", "punctuation.definition.comment"]
您可以修改您的 VS 代码,只需编辑您的设置文件在 VS 代码,并遵循以下3个步骤。
第一步:
第二步:
第三步:
为文档、块和行注释使用不同的颜色:
"editor.tokenColorCustomizations": { "[Cobalt2]": { "textMateRules": [ { "scope": [ "comment.block", "punctuation.definition.comment.end", "punctuation.definition.comment.begin" ], "settings": { "foreground": "#85b3f8", "fontStyle": "bold" } }, { "scope": [ "comment.block.documentation", "punctuation.definition.comment.begin.documentation", "punctuation.definition.comment.end.documentation" ], "settings": { "foreground": "#6bddb7", "fontStyle": "bold" } },{ "scope":["comment.line", "punctuation.definition.comment"], "settings": { "foreground": "#FF0000", "fontStyle": "bold" } } ] } }
用 C + + 测试。
在评论主题时,我发现 VS Code 的“ Better Comments”扩展非常有用。你可以给你的评论赋予不同的颜色,从而根据重要性等对你的评论进行分类。 默认注释颜色也可以更改 Https://marketplace.visualstudio.com/items?itemname=aaron-bond.better-comments 例如: 此扩展可以在用户设置或工作区设置中配置
VS 代码: 1.56.2
加入 settings.json:
settings.json
"editor.tokenColorCustomizations": { "textMateRules": [ { "scope": [ "comment", "comment.block.documentation", "comment.block.documentation.js", "comment.line.double-slash.js", "storage.type.class.jsdoc", "entity.name.type.instance.jsdoc", "variable.other.jsdoc", "punctuation.definition.comment", "punctuation.definition.comment.begin.documentation", "punctuation.definition.comment.end.documentation" ], "settings": { "fontStyle": "italic", "foreground": "#287a1d" } } ] }
如果仍然有东西丢失: CTRL+SHIFT+P = > Developer: Inspect Editor Tokens and Scopes悬停在没有正确着色的部分,并将它们添加到 "scope"。
CTRL+SHIFT+P
Developer: Inspect Editor Tokens and Scopes
"scope"
给你