Visually Organize Applications in VS Code with Window Color-Coding

Share this video with your friends

Social Share Links

Send Tweet

When working in a codebase that has frontend, backend, middleware, service, and other concerns all in the same GIT repository, it can be helpful to color-code your editor windows to quickly recognize in what area of your stack you are working.

We can easily do this with a few VS Code settings in the .vscode/settings.json file in a directory. We can then open those directories in new VS code windows and visually see the difference between our frontend code and our backend code, eliminating cognitive overhead and context switching between, for example, ReactJS and NodeJS.

An example configuration for this color coding:

{
  "workbench.colorCustomizations": {
    "titleBar.activeBackground": "#663399"
  }
}

David Poindexter: [0:00] Here, I have two windows open in Visual Studio Code. On the left is the frontend application, React. On the right is the backend application Node.js. The codebase between the frontend and the backend is very similar, both being JavaScript.

[0:16] It would be nice if we could visually distinguish the difference between our frontend and our backend so we know what area we're currently working in. This is where Visual Studio Code settings will help us out.

[0:28] We'll use command- or control-B to open our file browser. Inside of our frontend directory, we'll create a .vscode folder. Inside that folder, we'll create a settings.json file. Inside here, we'll create an object. We'll add workbench colorCustomizations, which is also an object. We'll use control- or command-B to get the file browser out of our way.

[1:05] Then here, we're going to key on the titleBar activeBackground. That red is a little bright. Let's go ahead and set this to a little bit of a gray. If you hit save, you could see the color of this title bar just got changed. Let's go ahead and do the exact same thing with our backend over here.

[1:29] Again, control- or command-B to open up the file browser. We'll create a .vscode folder. Inside there, we'll create a settings.json file. We'll create an object, workbench colorCustomizations, which is also an object. Inside there, we'll go with the titleBar activeBackground. Let's also set this to a gray. We'll go with a slightly darker gray. Give that a save. You can see that that changed.

[2:12] Let's go ahead and do another iteration pass because I want to be able to really distinguish that this is my React application that I'm working in. We're going to go ahead and choose something that's a little bit more of a React color like the React logo. Save that for our frontend.

[2:29] On our backend, we'll go over here and pick something that's a little bit more reminiscent of Node's green branding. Now you can see it's very clear to see the difference between the backend Node application and the frontend React application.