Customizing theme in Codium

Posted on Sat 17 September 2022 in Codium

Introduction

I just installed Codium from Snap as follows:

sudo snap install codium --classic

After that, I installed my preferred extensions:

 23:32:27  auraham@rocket ~ 
 > codium --list-extensions
arcticicestudio.nord-visual-studio-code     # Nord theme
donjayamanne.githistory                     # Git History
eamodio.gitlens                             # GitLens
elixir-lsp.elixir-ls                        # Elixir LSP
formulahendry.code-runner                   # Code Runner

Then, I decided to customize the Nord theme. To do so, you can read these resources:

In short, you need to edit your settings in:

~/.config/VSCodium/User/settings.json

There are two options that allows us to visually customize Codium:

  • editor.tokenColorCustomizations for setting the colors of the text editor.

  • workbench.colorCustomizations for setting the colors of UI elements.

This is the block I added in my settings for customizing Nord:

"editor.tokenColorCustomizations": {
    "[Nord]": {
        "keywords" : "#9888a5",
        "comments": {
            "fontStyle": "italic",
            "foreground": "#7483a1"
        },
        "textMateRules": [
            {
                "scope": "keyword.operator",
                "settings": {
                    "foreground": "#ffc09f"
                }
            },
            {
                "scope": "constant.numeric.elixir",
                "settings": {
                    "foreground": "#88c0c2"
                }
            }
        ]
    }
},

Note that these options only alter the specified theme, that is, "[Nord]". There are some elements that can be customized inside the "[Nord]" block including "keywords" and "comments". However, for other elements, you must provide a list of settings in "textMateRules". In the previous example, there are two scopes: "keyword.operator" and "constant.numeric.elixir". These scopes may be specific to a programming language. In order to know what is the scope of a given element in the text editor, press Ctrl Shift P and type this command:

> Developer: Inspect Editor Tokens and Scopes

That command starts the Scope Inspector. That tool shows information for the text under the cursor.

Codium

The textmate scopes property indicates the scope of the selected word. For example, in the previous picture, the property for "#{" is "punctuation.section.embedded.elixir". In that case, I wanted to set the foreground color for the # character inside a string used for string interpolation in Elixir. After identifying the scope you want to customize, you can change its properties as shown in the previous snippet.

You can also customize UI elements of Codium. The following block changes the background of the terminal and also the current line in the text editor:

"workbench.colorCustomizations": {
    "terminal.background":"#080808",
    "editor.lineHighlightBackground": "#353c4a",
    "editor.lineHighlightBorder": "#353c4a"
},

Useful tools

You can use the following tool for selecting colors in the screen:

sudo snap install pick-colour-picker

Finally, you can create palette of colors with coolors.co.