VS Code color customization not being applied in settings.json

69 views Asked by At

I've switching a few colours around from the Github Dark them to meet my preferences. When it comes the module imports and the "self" keyword for classes, the colour stays the default theme colour no matter what I try. Is there something overwriting my changes or am I missing something stupid?

settings.json

{
  "python.defaultInterpreterPath": "C:\\Users\\Shayn\\AppData\\Local\\Programs\\Python\\Python311\\python.exe",
  "python.formatting.provider": "none",
  "python.analysis.autoImportCompletions": true,
  "workbench.iconTheme": "eq-material-theme-icons-darker",
  "workbench.colorTheme": "GitHub Dark",
  "workbench.colorCustomizations": {
    "editor.background": "#252323"
  },

  "editor.tokenColorCustomizations": {
    "textMateRules": [
      {
        "scope": "entity.name.type.module.python", // change not implemented
        "settings": {
          "foreground": "#7EBDFF"
        }
      },
      {
            "scope": "variable.language.special.self.python",
            "settings": {
                "foreground": "#7EBDFF" // change not implemented
            }
        },
      {
        "scope": ["variable.parameter", "comment"],
        "settings": {
          "fontStyle": "italic"
        }
      },
      {
        "scope": "keyword.control.try-except.python",
        "settings": {
          "foreground": "#e06c75"
        }
      },
      {
        "scope": "entity.name.function",
        "settings": {
          "foreground": "#7EBDFF"
        }
      },
      {
        "scope": "entity.name.type.class",
        "settings": {
          "foreground": "#7EBDFF"
        }
      },
      {
        "scope": "punctuation.definition.string.begin",
        "settings": {
          "foreground": "#98c379"
        }
      },
      {
        "scope": "punctuation.definition.string.end",
        "settings": {
          "foreground": "#98c379"
        }
      },
      {
        "scope": "string.quoted.single",
        "settings": {
          "foreground": "#98c379"
        }
      }
    ]
  },
}
1

There are 1 answers

0
MingJie-MSFT On

For Python, the scope for the "self" keyword is variable.parameter.function.language.special.self.python, and for module names in import statements, it's entity.name.import.python.

You can use the following codes to set it:

  "editor.tokenColorCustomizations": {
  "textMateRules": [
    // ...

    {
      "scope": "variable.parameter.function.language.special.self.python",
      "settings": {
        "foreground": "#7EBDFF" 
      }
    },
    {
      "scope": "entity.name.import.python",
      "settings": {
        "foreground": "#7EBDFF" 
      }
    },

    // ...
  ]
},

It will be able to be displayed in the following colors:

enter image description here