我无法更改用于Python的深色Pro Visual Studio代码的可变颜色

2024-10-01 05:01:58 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个关于VisualStudioCodeOneDark Pro主题的问题。我想更改变量的颜色(只更改我声明的变量,不更改方法调用等),但是当我尝试使用

    "editor.tokenColorCustomizations": {
        "textMateRules": [
          {
            "scope": "source.python",
            "settings": {
              "foreground": "#E06C75"
            }
          }
        ]
      }

我明白了(我写了一个代码示例来说明发生了什么):

enter image description here

正如您所看到的,冒号是红色的,每个变量甚至“for i in…”和完整的“os.system.getcwd()”都是红色的

我只希望我声明的变量是红色的。我怎么做? 提前谢谢你


Tags: 方法声明source主题settings颜色editorpro
1条回答
网友
1楼 · 发布于 2024-10-01 05:01:58

可以使用Syntax Highlighting修改VSCode中的编辑器颜色,如下所示:

 "editor.tokenColorCustomizations": {
        "variables": "#c3e01f"
      },

或者像这样的Semantic Highlighting

  "editor.semanticTokenColorCustomizations": {
    "[The Theme Name]": {
      "rules": {
        "variable.declaration": "#c3e01f"
      }
  }
},

如果不知道要自定义的对象的范围,可以使用VSCode:Developer: Inspect Editor Tokens and Scopes(命令调色板)中的内置工具

我认为this articlethis one可以帮助您理解VSCode中的颜色定制

相关问题 更多 >