Juno55
Juno55

Reputation: 39

VS Code editor color customisation for Python imported module names

I have been trying to change the text foreground colour of imported modules in Python files without any success. I am using Monokai Dimmed color theme in VS Code. Everything is ok, except for the Red foreground color of imported modules.

In the example below, can I change the text color of 'json', 'pandas' and 'pd' ? Currently, they all appear in red, which hurst my eyes!

import json

import pandas as pd

I tried configuring settings.json:

   "editor.tokenColorCustomizations" : {

        "types": "#17851d",
        "[Monokai Dimmed]": {
            "textMateRules": [
                {
                  "scope": "????",   // I tried several scope, but none worked.
                  "settings": {
                    "foreground": "#FFFF00"    // Trying to change to yellow color
                  }
                }
              ]
        }
    }

Many thanks

Upvotes: 1

Views: 1086

Answers (1)

npc
npc

Reputation: 21

The scope is "entity.name.namespace". Use "Developer: Inspect Editor and Token Scopes" in command palette. Then click on the text you want to find the scope for and it will show up.

"editor.tokenColorCustomizations": {
    "[Monokai Dimmed]": {
        "textMateRules": [{
            "scope": "entity.name.namespace",
            "settings": {
                "foreground": "#59be97"
            }
        }]
    }
}

Upvotes: 2

Related Questions