Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/visual-studio-code/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual studio code 有没有办法改变VScode中注释的背景颜色?_Visual Studio Code - Fatal编程技术网

Visual studio code 有没有办法改变VScode中注释的背景颜色?

Visual studio code 有没有办法改变VScode中注释的背景颜色?,visual-studio-code,Visual Studio Code,我想更改评论的颜色,以便突出显示。大多数时候我更喜欢改变背景色。我在setting.json中找到了颜色设置。看起来像这样 "editor.tokenColorCustomizations": { "textMateRules": [ { "scope": "comment", "settings": { "fontStyle": "bold", "foregr

我想更改评论的颜色,以便突出显示。大多数时候我更喜欢改变背景色。我在
setting.json
中找到了颜色设置。看起来像这样

"editor.tokenColorCustomizations": {
    "textMateRules": [
        {
            "scope": "comment",
            "settings": {
                "fontStyle": "bold",
                "foreground": "#FFD83B"
            }
        }
    ]
}
它确实会改变,但似乎“设置”中没有“背景”选项。它说“目前不支持标记背景色。”
因此,我只能更改文本颜色,而不能更改背景。有什么方法可以在VSCode中设置注释的背景色吗?

内置的方法没有。您可以查看扩展名—搜索
注释
—以查看是否有任何扩展名这样做

或者,一种方法是使用类似的扩展。您可以使用正则表达式设置任何可以捕获的样式。在settings.json中:

"highlight.regexes": {

 "(//\\s*)(\\sTODO\\s)(\\s*?:?)(.*)": [
   {},
   {
    "overviewRulerColor": "#ffcc00", // does this work?
    // "backgroundColor": "#aaa",
    "color": "#fff",
    "fontWeight": "bold",
    "letterSpacing": "2.5px",
    "outline": "1px solid #aaa",
    // "border": "1px solid #fff",
    // "before": {
    //   "backgroundColor": "#fff",
    //   "contentText": " *** ",
    //   "fontWeight": "bold",
    //   "margin": "10px"
    //   // "width": "20px"
    // }
   },
   {},
   {
    "color": "#999",
    "fontStyle": "italic",
    "letterSpacing": "1px"
   }
 ],

 "(//\\s*)(-+\\s+//)": [
   {
    "color": "#000",
    "backgroundColor": "#aaa",
    "outline": "2px solid #aaa",
    "fontWeight": "bold",
   },
   {
    "overviewRulerColor": "#ffcc00",
    "backgroundColor": "#aaa",
    "color": "#000",
    "fontWeight": "bold",
    // "letterSpacing": "2.5px",
    "outline": "2px solid #aaa",
    // "border": "1px solid #fff",
    // "before": {
    //   "backgroundColor": "#fff",
    //   "contentText": " *** ",
    //   "fontWeight": "bold",
    //   "margin": "10px"
    //   // "width": "20px"
    // }
   },
 ]
},
收益率:


有关样式选项,请参见

这正是我所需要的!多谢各位