简体   繁体   English

如何更改 Python 类 VSCode 的颜色

[英]How to change color of Python classes VSCode

I was looking here and I'm getting stumped on how to change the color of classes in VSCode.我一直在看这里,我对如何更改 VSCode 中类的颜色感到困惑。 Currently, it looks like this:目前,它看起来像这样:

从路径库导入路径

... But I'm trying to change the color of classes and haven't been successful so far. ...但是我正在尝试更改课程的颜色,但到目前为止还没有成功。 So far, I've tried this:到目前为止,我已经尝试过:

{
    "python.pythonPath": "/usr/local/bin/python3",
    "python.languageServer": "Pylance",
    "python.showStartPage": false,
    "workbench.colorCustomizations": {},
    "editor.tokenColorCustomizations": {
        "textMateRules": [
            {
                "scope": "entity.name.class",
                "settings": {
                    "foreground": "#FF0000"
                }
            }
        ]
    }
}

Not sure what the value of scope should be to get this to work.不确定 scope 的值应该是多少才能使其正常工作。

You can use Inspect editor tokens and scopes to get token name (look at the semantic token type )您可以使用Inspect editor tokens and scopes来获取标记名称(查看semantic token type

在此处输入图像描述

Once you know token type set it in the settings一旦您知道令牌类型,请在设置中设置它

在此处输入图像描述

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

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