0
votes

I'm writing a vsCode extension, and from all their API I can't find how to edit colors, either of the active tab, or the title bar. All I can see is adding a status bar item.

What I have:

  let disposable = vscode.window.onDidChangeActiveTextEditor((e: vscode.TextEditor | undefined) => {

        if (!e) return null;

        var currentlyOpenTabfilePath = e.document.fileName;

        const color = 'green';
        changeColorInTitleBar(color) // This is what I need

    })

package.json:

  "menus": {
            "editor/title": [{
                "when": "textInputFocus == true",
                "command": "extension.sayHello",
                "group": "navigation"
            }]
        }

Should I edit the workspace.settings from the extension? or is there a vscode API way of doing it?

1

1 Answers

0
votes

The UI colors come from the user's theme. There is no api that allows extensions to change the UI colors programmatically because messing with a user's theme is almost always a bad idea. You will get it wrong and break people's weird custom themes and piss them off.

If you really want to go down this path, your extension could write to the workbench.colorCustomization settings to override theme colors. That said, don't do this unless you really know what you are doing and have a very good reason to be doing it.