Nuu*_*uuu 53 visual-studio-code vscode-settings
我浏览了https://code.visualstudio.com/docs/getstarted/theme-color-reference,但似乎无法找到更改注释颜色的设置.
我目前正在使用Atom One Dark Theme,只是想稍微减轻颜色,这样我就能更好地阅读它.
Ale*_*lex 105
从1.15(2017年7月)起,您可以从settings.json Ctrl + 更改它,
"editor.tokenColorCustomizations": {
"comments": "#d4922f"
},
Run Code Online (Sandbox Code Playgroud)
从1.20(2018年1月)起,您也可以分别为每个主题执行此操作:
"editor.tokenColorCustomizations": {
"[Atom One Dark]": {
"comments": "#d4922f"
}
},
Run Code Online (Sandbox Code Playgroud)
找到合适的范围:
开发人员:检查TM Scopes editor.action.inspectTMScopes
选择器优先级:
https://code.visualstudio.com/blogs/2017/02/08/syntax-highlighting-optimizations#_textmate-themes
好的,更多的例子(for js):
"editor.tokenColorCustomizations": {
"textMateRules": [{
"scope": "INSERT_SCOPE_HERE",
"settings": {
"foreground": "#ff0000"
}
}]
}
Run Code Online (Sandbox Code Playgroud)
comment
punctuation.definition.comment
comment.block.documentation
storage.type.class.jsdoc
entity.name.type.instance.jsdoc
variable.other.jsdoc 
小智 23
在 VS 代码中:1.56.2
添加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"
}
}
]
}
Run Code Online (Sandbox Code Playgroud)
如果仍然缺少内容:CTRL+SHIFT+P=> (请参阅@Gabriel Staples在@Alex 的主要答案Developer: Inspect Editor Tokens and Scopes中添加的屏幕截图,此处)。将鼠标悬停在颜色不正确的部分上并将它们添加到。"scope"
你在这。:)
Mar*_*ark 14
扩大答案和@Johnny Derp的评论.您可以使用以下方法更改字体颜色和样式:
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "comment",
"settings": {
"fontStyle": "italic",
"foreground": "#C69650",
}
}
]
},
Run Code Online (Sandbox Code Playgroud)
background这种方式无法改变,只有颜色和风格.截至2018年6月.
然后搜索settings.json
打开文件,然后添加以下代码行:
"editor.tokenColorCustomizations": {
"comments": "#229977"
},
Run Code Online (Sandbox Code Playgroud)
通过将鼠标悬停在颜色上并选择所需的颜色来根据自己的喜好更改评论的颜色。
然后保存更改。(Ctrl + S)退出程序。再次打开它,您将看到更改。

为文档、块和行注释设置不同的颜色(在 C++ 中测试):
即主题Cobalt2:
"editor.tokenColorCustomizations": {
"[Cobalt2]": {
"textMateRules": [
{
"scope": [
"comment.block",
"punctuation.definition.comment.end",
"punctuation.definition.comment.begin"
],
"settings": {
"foreground": "#85b3f8",
"fontStyle": "bold"
}
},
{
"scope": [
"comment.block.documentation",
"comment.block.javadoc.java",
"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"
}
}
]
}
}
Run Code Online (Sandbox Code Playgroud)
顺便说一句:新的默认主题被称为[Default Dark Modern],旧的默认主题被称为[Default Dark+]。您可以将模组同时应用于多个主题,只需将它们放在同一个引号中即可。( "[Default Dark Modern][Default Dark+]")。
看起来目前无法在设置中自定义令牌颜色:
最突出的编辑器颜色是基于安装的语言语法的标记颜色。这些颜色由颜色主题定义,并且(当前)不能在设置中自定义。
来源:https : //code.visualstudio.com/docs/getstarted/theme-color-reference
我确实注意到,如果你进入主题文件夹,例如:C:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\theme-monokai 并编辑 monokai-color-theme.json 文件,看看对于带有“name”的行:“Comment”并更改“前景”颜色它将起作用。只需确保重新启动程序即可。
在评论评论主题时,我发现 VS Code 的“Better Comments”扩展非常有用。您可以为您的评论提供各种颜色\xe2\x80\x8e,从而根据重要性等对您的评论进行分类。\xe2\x80\x8e\n默认评论颜色也可以更改。\xe2\x80\x8e\n https:// Marketplace.visualstudio.com/items?itemName=aaron-bond.better-comments
\n示例:\xe2\x80\x8e
\n
\n可以在用户设置或工作区设置中配置此扩展。\xe2\x80\x8e
小智 5
就像马克说的,但在"scope":后面添加"comment"
“标点符号.定义.注释”
也给标点符号上色,
例如(
//在javescript中|/* */在css中|<!-- -->在html中)。
"scope": ["comment", "punctuation.definition.comment"]
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
32787 次 |
| 最近记录: |