gitgraph.js icon indicating copy to clipboard operation
gitgraph.js copied to clipboard

Custom styling of line between two commits

Open lroal opened this issue 5 years ago • 3 comments

Is your feature request related to a problem? Please describe. Is there a way style the line between two commits ? I would like to have in a color different from the branch color. Also, is it possible to have a dotted line instead of a solid/filled (between two commits) ?

Describe the solution you'd like Some kind of template on the commit to override the branch default.

Describe alternatives you've considered Use before and after hooks

lroal avatar Jan 24 '20 13:01 lroal

Hello @lroal , For now we can only customize a full branch, not just in between two commits.

All the options for branch are there https://github.com/nicoespeon/gitgraph.js/blob/5ea521c45d7fc0222e153b8161a10546d24af608/packages/gitgraph-core/src/template.ts#L48-L69

So no dotted line for now, but we are open to contributions 😁

A different style between commits should be possible but I didn't touch this codebase since a long time so I can't tell you how hard it can be to implement ^^

Roughly (if I remembered well), the branch are just points calculated from commits https://github.com/nicoespeon/gitgraph.js/blob/5ea521c45d7fc0222e153b8161a10546d24af608/packages/gitgraph-core/src/branches-paths.ts#L91 and the color is injected after https://github.com/nicoespeon/gitgraph.js/blob/5ea521c45d7fc0222e153b8161a10546d24af608/packages/gitgraph-react/src/Gitgraph.tsx#L184

Definitely a fun challenge to add this granularity 😁

As workaround, you could probably retrieve the position of the commits and draw on top of the actual branch (but I need to get back a bit more in the code to be sure that it's doable)

fabien0102 avatar Jan 24 '20 14:01 fabien0102

Thanks

lroal avatar Jan 27 '20 08:01 lroal

This would be very useful to mark squash merges for example.

michaelschufi avatar Sep 09 '20 10:09 michaelschufi