Helping people get useful things done with computers. Promoting the Open Web and Basic Income.
61 stories
·
0 followers

Setting the title bar colour in VS Code

1 Share

Workspaces are an incredibly useful feature of VS Code, especially if you are working on multiple projects. A workspace can contain one or more root folders that contain your project's code; VS Code will remember the state of the workspace on startup, such as which files you had open, the position of the cursor, etc.; and you can enable and disable extensions on a per-workspace basis.

The Problem

It can be very difficult to tell at a quick glance which workspace you've currently got open. And if you have multiple windows open, each for a different workspace, it's hard to differentiate them.

In the screenshot below, the only thing that tells us which workspace we're in is the name appended to the filename in the title bar.

Screenshot of a VS Code workspace with the default uncoloured title bar

The Solution

Note: Unfortunately this solution is currently only supported in VS Code for MacOS - sorry Windows and Linux users :(

VS Code has a couple of settings that allow us to specify the title bar background and foreground colours on a per-workspace basis, so that each workspace is visually distinct. By using a different colour for each of your workspaces, you can instantly see which one you're currently in.

Here's the same workspace as above, but with a coloured title bar:

Screenshot of a VS Code workspace with a bright red title bar

How-to

The title bar colours are defined in the workspace settings (which override your user settings). Open up the command palette and find Open Workspace Settings (or type ⌘, then click the Workspace Settings tab).

You can see your workspace folder path(s) in the folders option, then a settings option (which may or may not be empty). Within the settings section, add a workbench.colorCustomizations option with four sub-options like this:

{
    "folders": [
        {
            "path": "/path/to/my/workspace/folder"
        }
    ],
    "settings": {
        "workbench.colorCustomizations": {
            "titleBar.activeBackground": "#d12229",
            "titleBar.activeForeground": "#ffffff",
            "titleBar.inactiveBackground": "#811519",
            "titleBar.inactiveForeground": "#cccccc"
        }
    }
}

View on Gist

I tend to use a bold colour taken from the theme of the website I am working on for the active background, with either white or very dark grey for the text colour, whichever is most readable. VS Code provides a handy colour picker when you click on a hex colour code, so adusting the colours is very easy.

The inactive colours are used when the VS Code window is not currently focused. For these I darken both colours slightly, just enough to show it's unfocused but still recognisable as that workspace. If you are happy with the same colours for active and inactive, you can delete the two inactive options.

Read the whole story
keybits
2111 days ago
reply
West Cork, Ireland
Share this story
Delete

It’s time to accept the facts

1 Share
We can’t grow good crops without using pesticides, fertilisers and GMOs. We need to stop listening to ‘experts’ who say We can garden in a sustainable, organic way. Eco-minded people are creative and develop new ideas. But the thing is: The population is rising, gardens are getting smaller and our soils are degraded. And it’s […]
Read the whole story
keybits
2618 days ago
reply
West Cork, Ireland
Share this story
Delete

2017 DuckDuckGo Donations: $300,000 to Raise the Standard of Trust Online

1 Share

For our seventh year we are making donations to organizations that raise the standard of trust online.

Read the whole story
keybits
2618 days ago
reply
West Cork, Ireland
Share this story
Delete

Trello Goes Off The Hook: Work Everywhere With Mobile Offline

2 Shares
Read the whole story
keybits
2626 days ago
reply
West Cork, Ireland
Share this story
Delete

Planting and growing truth

1 Share
Pennyroyal, a divisive herb I am a digital native. I have been using the world wide web (WWW) almost since its inception, when outside of a university you needed a modem to access it, and to be frank it mostly wasn’t worth the effort. But as the WWW (which, from now on I will refer […]
Read the whole story
keybits
2641 days ago
reply
West Cork, Ireland
Share this story
Delete

2017 New Year Resolutions for the Gardener

1 Share
It’s time to shake the mud of 2016 off our boots, and head to prepare the soil for 2017 (metaphorically speaking). I have the bones of a planting plan for next year, which will be subject to revisions, and we know which areas of the garden still need work. In the two years since we […]
Read the whole story
keybits
2662 days ago
reply
West Cork, Ireland
Share this story
Delete
Next Page of Stories