Problem/Motivation
The colors seem to repeat instead of swapping colors for a new branch.
Steps to reproduce
Make a revision graph with a lot of branches.

Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| Screenshot_20250529_111922.png | 30.44 KB | djdevin |
Comments
Comment #2
d34dman commented@djdevin,
Background
The current logic is it, it picks up from a set of 7 colors (https://git.drupalcode.org/project/revision_graph/-/blob/3.x/js/init.js?...).
To avoid picking up "random" colors on each re-load or if the order of revisions changes in the commit list, the color is picked based on a hash function https://git.drupalcode.org/project/revision_graph/-/blob/3.x/revision-gr...
So it is totally possible to have a collision as the hash function could return same in text for different branch names.
Things I tried before the current solution was chosen
Before arriving at the solution that I use right now, we tried increasing the number of colors which would still not avoid, however the chances of pollution can be reduced. the problem with that approach was to make the colors accessible while still maintaining a huge range and a point it was really becoming difficult to differentiate between three different or four different kinds of blues or greens.
What has not been released but because it has not been tested well enough is that we could possibly supply colors along with the branch from backend so that it gets used. This gives a possibility to override the colors by using some altars hooks from another module or from config.
The video was not implemented because nobody asked for it yet. however please do note that choosing the variations of colors is a lot of effort so I'm not sure how useful this would be. What do you say?
Comment #3
d34dman commentedComment #5
djdevinSorry I did not respond in a timely manner.
Figma, Wix et. al seemed to solve this, likely by generating palettes. I think this is still a feasible feature.
With a lot of revs/languages/whatever it becomes an issue when they're the same color.
Happy to take it on once I get the time.
Comment #6
d34dman commented@djdevin am working on 4.x version which is a big UX/UI refactor. Do you have suggestions on what you would like to have in 4.x, which already ships with a breaking changes?
Comment #7
d34dman commentedComment #8
d34dman commentedI can expose the Pallete as configuration to resolve this issue. By default it will take some pre-defined colors.
Comment #9
d34dman commentedComment #10
d34dman commentedGood news, Fixed in 4.0.0 :)