简体   繁体   English

如何在python中制作VSCode自定义颜色ALL_CAPS变量?

[英]how to make VSCode custom color ALL_CAPS variables in python?

I have the following code我有以下代码

在此处输入图片说明

I would like to know if there is a way to customize a rule to only color CAPITALIZED variables like so:我想知道是否有一种方法可以自定义规则以仅为 CAPITALIZED 变量着色,如下所示:

在此处输入图片说明

Is it possible to somehow hack this in the settings?是否有可能在设置中以某种方式破解它? perhaps specify a list of variables we want highlighted with a #HEX color scheme.也许指定一个我们想要用#HEX 配色方案突出显示的变量列表。

you could use TODO Highlight extension.你可以使用TODO Highlight扩展。

in the settings you can set a keywordsPattern or even just a list of specific keywords (as the name suggests, it originally intended to highlight TODO , but the settings allow you to fully customize it...)在设置中你可以设置一个keywordsPattern ,甚至只是一个特定关键字的列表(顾名思义,它最初是为了突出显示TODO ,但设置允许你完全自定义它......)

you could try this:你可以试试这个:

1.find out the textmate scopes by "Trigger the scope inspector from the Command Palette with the Developer: Inspect Editor Tokens and Scopes" 2.in your users setting replace the "scope" in below code and change the color 1.通过“使用开发人员从命令面板触发范围检查器:检查编辑器令牌和范围”找出文本范围检查器2.在您的用户设置中替换以下代码中的“范围”并更改颜色

"editor.tokenColorCustomizations": {
     "textMateRules": [
      {
        "scope": "constant.other.caps.python",
        "settings": {
          "foreground": "#f5f5f5"
      }
    }
    ]
},

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM