Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Color tabs based on directory #135175

Closed
qpwo opened this issue Oct 15, 2021 · 6 comments
Closed

Color tabs based on directory #135175

qpwo opened this issue Oct 15, 2021 · 6 comments
Labels
feature-request Request for new features or functionality themes Color theme issues workbench-tabs VS Code editor tab issues

Comments

@qpwo
Copy link

qpwo commented Oct 15, 2021

Problem: forgetting your folder

When editing a workspace that has very different directories, such as client and server, it's easy to accidentally write insecure code if you think you're in client when you're in server.

Solution: Assign a color to a directory/folder in project and color the tab/file everywhere

Right click on a folder and click 'color directory'. This adds a line to your settings.json:

{
    "workbench.colorCustomizations": {
         "directories": {
             "server": "red",
             "client": "blue",
         }
    }
}

The tab's / file's color will be shown in explorer, git diff, the tab on top, ctrl-tab, and command-p.

See also

@NotWearingPants
Copy link
Contributor

Sounds useful, but this should use general glob paths rather then just directories. This way you can color specific file extensions in different colors.

@bpasero bpasero added feature-request Request for new features or functionality themes Color theme issues workbench-tabs VS Code editor tab issues labels Oct 16, 2021
@bpasero bpasero removed their assignment Oct 16, 2021
@qpwo
Copy link
Author

qpwo commented Nov 5, 2021

Also related to #62432 #38857 #62104 #97146 #28717 #31308 #21030 #10748 #66640 #92050 #108667 #115792 #124982 #121738 #126689 #129033 #74404 #75719 #35379 . I would judge there is significant demand for this feature.

@mark-pictor-csec
Copy link

mark-pictor-csec commented Dec 7, 2021

My use case would be to color tabs based on which "project folder" the file was under, where project folder means a top level folder in the workspace (not sure if there's a better name).

This would allow me to tell at a glance which repo/project a file belonged to, without having to click the tab and look at the displayed path.

To generate unique but persistent colors, I would hash the folder path (or workspace name + folder name) and use the first 3 bytes as the color. It'd also be nice to be able to override the colors - perhaps based on regex - in the settings file. This would mean the colors were still useful even if two folders resulted in very similar hashes.

Another option for folder colors would be to use git's upstream repo url (part of the output of git remote -v show) as the hash input.

@github-actions github-actions bot locked and limited conversation to collaborators Jan 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality themes Color theme issues workbench-tabs VS Code editor tab issues
Projects
None yet
Development

No branches or pull requests

5 participants
@bpasero @qpwo @NotWearingPants @mark-pictor-csec and others