read

I love the Dark+ Default Theme for vscode, but when programming in Python I always thought the class instance references (aka self) was too bright, which made the core in the class harder to read.

Before: Dark+ Default Theme, with self in light blue

After: Customizing%20vscode%20themes%

It's pretty easy to customize any attribute in Visual Studio Code — you just need to know which token scope to use. With the cursor over the keyword, use Command Palette (CTRL-SHIFT-P) and select "Developer: Inspect Editor Tokens and Scopes" (official documentation).

The scope for self will show something like this:

Scope for self class instance reference

We're interested in "variable.language.special.self.python". With the knowledge of your scope, open settings.json (CTRL+Comma), and add the following snippet:

"editor.tokenColorCustomizations": {
        "textMateRules": [
            {
                "scope": "variable.language.special.self.python",
                "settings": {
                    "foreground": "#666666"
                }
            }
        ]
    }

Save, and you're done!


Blog Logo

Gui Ambros

Maker, engineer, ad:tech veteran. Incurable optimist. I was there when the web was born. Opinions here are my own. @GuiAmbros


Published

Image

wrgms.com

/dev/random rants about technology, electronics, startups.

Back to Overview