在VSCode主题中自定义块引用的颜色

4
我在VScode中使用Nord主题。Markdown文件中的块引用看起来很难读。如何改变文本背景?

enter image description here

我已经在用户设置中尝试了以下操作,但它没有起作用:
"workbench.colorCustomizations": {
    "textBlockQuote.background": "#ff0000", // changes the markdown preview
    "editor.textBlockQuote.background": "#0000ff", // Property not allowed
    "[Nord]": {
        "textBlockQuote.background": "#ff0000", // changes the markdown preview
    },
},
"editor.tokenColorCustomizations": {
    "textBlockQuote.background": "#ff0000", // Property not allowed
    "editor.textBlockQuote.background": "#ff0000", // Property not allowed
    "[Nord]": {
        "textBlockQuote.background": "#ff0000", // Property not allowed 
        "editor.textBlockQuote.background": "#ff0000", // Property not allowed
    }
},
3个回答

6
编辑器的颜色来自于TextMate语法着色。如果要覆盖它,您需要使用editor.tokenColorCustomizations中的textMateRules部分进行操作。请参考自定义配色方案
"editor.tokenColorCustomizations": {
    "[Nord]": {
        "textMateRules": [
            {
                "scope": "markup.quote.markdown",
                "settings": {
                    "foreground": "#f0f"
                }
            }
        ]
    }
}

这里使用的范围(markup.quote.markdown)是 markdown 块引用的 TextMate 范围。您可以在 VS Code 中使用 Developer: Inspect TM Scopes 命令确定目标范围。
请注意,VS Code 不支持设置文本的背景颜色。这个问题在这里被跟踪:https://github.com/Microsoft/vscode/issues/3429

1
我使用 Slack主题茄紫暗色调,并需要更改以下内容:
   "editor.tokenColorCustomizations": {
        "[Slack Theme Aubergine Dark]": {
            "comments": "#ffa600",
            "textMateRules": [
                {
                    "scope":"markup.quote.markdown",
                    "settings": {
                        "foreground": "#FF0000",
                        "fontStyle": "bold"
                    }
                }
            ]

        },

    },

0

我尝试过这个,运行良好:

     "workbench.colorCustomizations": { 
       "textBlockQuote.background":"#95e0d6"
    } 

Screenshot


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接