skip to Main Content

I’m using VS Code and I’m trying to set the editor.background color according to the file path of the opened document.

So far, I installed Peacock:

{
    "settings": {
        "peacock.favoriteColors": [
            {
                "name": "Flutter",
                "value": "#0C1E28FF"
            },
            {
                "name": "Server",
                "value": "#240A0AFF"
            }
        ]
    }
}

Is there a way to distinguish which open file belongs to which folder, by assigning a specific color to the editor.background key?

Note that I don’t want to create different workspaces, as the various folders share same resources.

2

Answers


  1. If you want to change the background color ,you can add some commands in settings.json .By doing this you can change the background color depending on the folders.Here you need to use command palette while opening the file.This will set the color according to the folder.

    for example:

    In settings.json

    {
      "peacock.wishColor":[
       {
        "name":"myColor",
        "value":"#3CB371"
        }
       ]
    }
    

    Ctrl+shift+P then run Change Color of Active Worksapce. When you want to change the color, by selecting the myColor from list you can change the color.

    As for as I know,I wrote this.If there are any mistakes please forgive me in advance.

    Login or Signup to reply.
  2. You can use an extension I wrote: When File

    Example from the doc:

      "whenFile.change": {
        "byLanguageId": {
          "python": {
            "workbenchColor": {
              "editor.background": "#ddddff"
            }
          },
          "html": {
            "workbenchColor": {
              "editor.background": "#ddffdd"
            }
          }
        },
        "/projects/server/": {
          "workbenchColor": {
            "activityBar.background": "#509050"
          }
        },
        "/projects/client/": {
          "workbenchColor": {
            "activityBar.background": "#905080"
          }
        },
        "/.*\.log$": {
          "workbenchColor": {
            "activityBar.background": "#acad60"
          }
        }
      }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search