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

Graph color palette #123

Open
dimateos opened this issue Nov 28, 2024 · 3 comments
Open

Graph color palette #123

dimateos opened this issue Nov 28, 2024 · 3 comments

Comments

@dimateos
Copy link
Contributor

Hey again!

I was wondering how colors per branch are picked.
For example in this case I ended up with very low contrasty colors: red, orange, orange again, red again...

I think that what mhutchie.git-graph did was have a set of very high contrast colors and assign them from left to right, so at least the top of the graph would have 2/3 nicely different colors.

Here it seems that the colors are assigned per branch retrieved or something?

image


Also can the colors be tweaked in the CSS?
And the highlighted branch line background? line thickness? The subtle gray highlight looks a bit bad in a dark background.

Tagging #56 as colors should be part of the design

@phil294
Copy link
Owner

phil294 commented Nov 29, 2024

They are currently calculated based on the hash of the branch name, so always stable. They are picked from a set of pre-defined colors. These aren't super great though, some aren't quite readable - especially in light theme which we support now. Note that the background color is now also variable, so avoiding e.g.blue on blue entirely is difficult.

Modifying by CSS is possible, but I don't think the branch names are exposed as class names (or are they?), so you could only change them all to the same color. The other properties like thickness can be tweaked with custom CSS option. Yep, the shadow color is too bright

@dimateos
Copy link
Contributor Author

dimateos commented Dec 2, 2024

I dont see them as class names nope, I guess I could select them based on exact stroke color and swap it, not ideal.

  • Maybe the set of pre-defined colors could be a setting? Instead of relying on the custom css
    • The setting for css IMO is great for tweaking without waiting for specific settings tho!

I see the benefit of always using the class names instead of the relative position of the branch in the graph: you get matching branch colors in the branch selector + (if you do not rename the remote) same colors as your colleagues.
image

But potentially you can get the same/similar colors for parallel branches, so maybe its worth considering an alternative even if you loose then constant coloring: the user may simply need high contrast colors for the current branches shown in the graph.

So the current method is NICE so definitely would keep it as an option (even the default probably), but we could leave this issue open to reference its trade-offs and a potential alternative setting.

@phil294
Copy link
Owner

phil294 commented Dec 2, 2024

Jup, both good ideas!

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

No branches or pull requests

2 participants