首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何在visual studio代码中更改注释的颜色?

如何在visual studio代码中更改注释的颜色?
EN

Stack Overflow用户
提问于 2017-07-19 23:30:31
回答 5查看 90.1K关注 0票数 107

我浏览了https://code.visualstudio.com/docs/getstarted/theme-color-reference,但似乎找不到更改注释颜色的设置。

我目前正在使用Atom One Dark主题,只是想把颜色变亮一点,这样我就可以更好地阅读它。

EN

回答 5

Stack Overflow用户

发布于 2019-03-12 10:21:38

转到您的设置。

然后搜索settings.json

打开文件,然后添加以下代码行:

代码语言:javascript
运行
复制
"editor.tokenColorCustomizations": {

        "comments": "#229977"
    },

根据您的喜好更改注释的颜色,方法是将鼠标悬停在颜色上并选择所需的颜色。

然后保存更改。(Ctrl+S)退出程序。再次打开它,您将看到更改。

票数 40
EN

Stack Overflow用户

发布于 2021-06-17 02:37:23

在VS代码中: 1.56.2

添加到settings.json

代码语言:javascript
运行
复制
"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"
        }
      }
    ]
  }

如果仍然缺少stoff:CTRL+SHIFT+P => Developer: Inspect Editor Tokens and Scopes将鼠标悬停在未正确着色的零件上,并将它们添加到"scope"

原来你在这儿啊。:)

票数 9
EN

Stack Overflow用户

发布于 2020-07-13 23:46:56

文档、块和行设置

要使文档、块和行注释具有不同的颜色,请执行以下操作:

代码语言:javascript
运行
复制
"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++进行了测试。

票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45195023

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档