简体   繁体   English

如何更改VScode中变量的颜色?

[英]how to change the color of variables in VScode?

I started learning python recently.最近开始学习python。 I use vscode and i really hate the default variable color in vscode(white) i want to change it to something colorful.我使用 vscode,我真的很讨厌 vscode(white) 中的默认变量颜色,我想把它改成彩色的。 I tried searching online most of them say to edit in settings.json .我试着在网上搜索,他们中的大多数人都说要在settings.json中进行编辑。 I couldn't figure out how.我不知道怎么办。

edit: i edited my settings.json to this编辑:我编辑了我的settings.json到这个

{
    "python.pythonPath": "c:\\Users\\Kakshipth\\Documents\\coding\\py\\virtualauto\\Scripts\\python.exe",
    "code-runner.respectShebang": false,
    
    "editor.tokenColorCustomizations": {
        "variables": "#1100ff"
     },
}

but still the color for variables did not change但变量的颜色仍然没有改变

In Visual Studio Code, use Ctrl + Shift + P and type settings.json to the field that shows up.在 Visual Studio Code 中,使用Ctrl + Shift + P并在显示的字段中键入settings.json After you type it, it should give you the settings.json file as the first search result.键入后,它应该会为您提供 settings.json 文件作为第一个搜索结果。 Just click on it and the file should open.只需单击它,文件就会打开。 Once you open the settings.json file, you can check this answer to see how to change the color of variables.打开 settings.json 文件后,您可以查看此答案以查看如何更改变量的颜色。

You can try with command line:您可以尝试使用命令行:

 "editor.tokenColorCustomizations": {
    "textMateRules": [
        {
            "scope": "variable",
            "settings": {
                "foreground": "#c70a39",
            }
        }
    ]
}

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

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