skip to Main Content

I want to change the color of this keyword in python:

global

but I don’t know how to change it in my settings.json file.

Here is my the tokenColorCustomizations part of my vscode settings.json file:

{
    "editor.tokenColorCustomizations": {
        "comments": "#00af0c",
        "strings": "#c7884a",
        "variables": "#91e2ff",
        "functions": "#fff07a",
        "keywords": "#d981ff",
        "types": "#ff73d3",
        "numbers": "#beffac",
        "textMateRules": [
            {
                "scope": "keyword.operator",
                "settings": {
                    "foreground": "#786831"
                }
            },
            {
                "scope": [
                    "source.python",
                    "punctuation.definition.variable.python"
                ],
                "settings": {
                    "foreground": "#ffcaca"
                }
            }
        ]
    }
}

Can someone please help me? ChatGPT was no help at all. I also already tried some other scopes, but they did not work.

2

Answers


  1. Chosen as BEST ANSWER

    What about these:

    in
    is
    ((())) # different parentheses colors
    None
    import module # the module name
    

  2. You want the TextMate scope storage.modifier.declaration.python. Ex.

    "editor.tokenColorCustomizations": {
        "[Your Theme Name Here]": { // TODO. Or remove this wrapper to apply regardless of current theme
            "textMateRules": [{
                "scope": "storage.modifier.declaration.python",
                "settings": {
                    "foreground": "#FF0000", // TODO
                    // "fontStyle": "bold",
                },
            }],
        },
    },
    

    Next time use the scope inspector by running Developer: Inspect Editor Tokens and Scopes in the command palette. See also the official syntax highlighting docs and VS Code’s builtin Python TextMate grammar.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search