在 VSCode 主题中自定义块引用颜色 [英] Customize block quote color in VSCode theme

查看:64
本文介绍了在 VSCode 主题中自定义块引用颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 VScode 中使用

我在用户设置"中尝试了以下操作,但不起作用:

"workbench.colorCustomizations": {"textBlockQuote.background": "#ff0000",//更改降价预览"editor.textBlockQuote.background": "#0000ff",//属性不允许[北]":{"textBlockQuote.background": "#ff0000",//更改降价预览},},editor.tokenColorCustomizations":{"textBlockQuote.background": "#ff0000",//属性不允许"editor.textBlockQuote.background": "#ff0000",//属性不允许[北]":{"textBlockQuote.background": "#ff0000",//属性不允许"editor.textBlockQuote.background": "#ff0000",//属性不允许}},

解决方案

编辑器着色来自 textmate 语法.要覆盖它,您需要使用 textMateRules 部分"noreferrer">editor.tokenColorCustomizations

"editor.tokenColorCustomizations": {[北]":{文本伴侣规则":[{范围":markup.quote.markdown",设置":{前景":#f0f"}}]}}

这里使用的范围 (markup.quote.markdown) 是 markdown 块引号的 textmate 范围.您可以使用 VS Code 中的 Developer: Inspect TM Scopes 命令来确定目标范围

请注意,VS Code 不支持设置文本的背景颜色.这是在此处

跟踪

I am using Nord theme in VScode. The block quotes in the markdown files look like this which is very illegible. How to change the text background?

I have tried the followings in User Settings but it not working:

"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
    }
},

解决方案

The editor colorization comes from a textmate grammar. To override this, you need to use the textMateRules section of editor.tokenColorCustomizations

"editor.tokenColorCustomizations": {
    "[Nord]": {
        "textMateRules": [
            {
                "scope": "markup.quote.markdown",
                "settings": {
                    "foreground": "#f0f"
                }
            }
        ]
    }
}

The scope used here (markup.quote.markdown) is the textmate scope of markdown block quotes. You can use the Developer: Inspect TM Scopes command in VS Code to determine the target scope

Note that VS Code does not support setting the background color of text. This is tracked here

这篇关于在 VSCode 主题中自定义块引用颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆