mermaid-js / mermaid

Generation of diagrams like flowcharts or sequence diagrams from text in a similar manner as markdown
https://mermaid.js.org
MIT License
69.17k stars 6.12k forks source link

Allow to define the branch colour in the branch definition (`colour|color:` like `order:` ) #5382

Open Alevale opened 4 months ago

Alevale commented 4 months ago

Proposal

I think a better way to showcase items is grouping them by colour, but in the current implementation it's really difficult to add colours and maintain a graph that has them.

Let's add a color or colour parameter to the branch that lets you specify how to show it.

Right now the only way to colour a branch is using the themeVariables and while that works, that doesn't escale very well nor seem maintainable.

This would also decouple the colour of the branches from the order they appear in, making the maintenance of a graph easier on the long term.

Example

gitGraph LR:
    commit
    commit

    branch S-1 order:0 color:"red"
    checkout S-1
    commit
    checkout main
    merge S-1

    branch S-2 order:1 color:"lightblue"
    checkout S-2
    commit tag:"16.1.0"
    checkout main
    merge S-2

    commit
    commit

Screenshots

No response