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

Add Support for Custom Branch Colors #809

Open
grel0 opened this issue Mar 23, 2024 · 1 comment
Open

Add Support for Custom Branch Colors #809

grel0 opened this issue Mar 23, 2024 · 1 comment
Assignees
Labels
feature request Feature request

Comments

@grel0
Copy link

grel0 commented Mar 23, 2024

Describe the feature that you'd like
It would be nice to have a feature that allows for the customization of branch colors based on branch names or patterns. This feature would enhance the visual representation of different branches in the Git Graph, making it easier to distinguish between them at a glance.

Additional context (optional)
Enhanced visual differentiation between branches.
Improved navigation and identification of branches in the Git Graph.
Customization options to suit individual preferences and project requirements.

@grel0 grel0 added the feature request Feature request label Mar 23, 2024
@geekley
Copy link

geekley commented Mar 26, 2024

Yes, please! I was about to request this too.

It's better to use regexes than something like globs because they are simple to implement and the most flexible.
Here's an example of how I'd like to set it up (and a good default, IMO):

// Each key name is a JS regex. Values are hex RGB codes.
// It matches against only the part after the remote name, if present
// (so respective local and remote branches have the same color).
"git-graph.graph.branchColors": {
  "^(?:master|main|stable|prod(?:uction)?)(?:$|\\b)": "#d9008f", // blue
  "^(?:latest|edge|unstable|dev(?:el(?:op(?:ment)?)?)?)(?:$|\\b)": "#00d90a", // green
  "^feat(?:ure)?s?(?:$|\\b)": "#a300d9", // purple
  "^(?:bugs?|(?:bug-?)?fix(?:es)?)(?:$|\\b)": "#d98500", // orange
  "^releases?(?:$|\\b)": "#00d9cc", // cyan
  "^hot-?fix(?:es)?(?:$|\\b)": "#0085d9", // red
  "^(?:sup|back-?)?ports?(?:$|\\b)": "#ffcc00", // yellow
}
"git-graph.graph.tagColors": {
  "^[vV]?\\d+(?:\\.\\d+)*[-/\\w]*(?:$|\\b)": "#00d9cc", // cyan
}

These defaults I'm suggesting are based on the git-flow branching model, with some possible name variations/synonyms people are likely to use.

Of course, if you e.g. removed the line for feature, the fallback is that you'd still get different colors for every feature/* branch, like how it works now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Feature request
Projects
None yet
Development

No branches or pull requests

3 participants