Tuesday, 5 September 2023

How to Customize Line Color in PlantUML Class Diagrams

Class1 -[#red]-> Class3

 

Above statement applies red color to the connecting line between Class1 and Class3.

 

lineColor.txt

@startuml

class Class1
class Class2

Class1 --> Class2
Class1 -[#red]-> Class3
Class1 -[#blue]-> Class4
Class1 -[#green]-> Class5 
Class1 -[#0000ff]-> Class6
Class1 -[#gold]-> Class7

@enduml

 

Above snippet generate below diagram.

 


 

We can combine line color and line style at the same time.

Class1 -[#red,bold]-> Class3

 

lineColorAndStyle.txt

@startuml

class Class1
class Class2

Class1 --> Class2
Class1 -[#red,bold]-> Class3
Class1 -[#blue,dashed]-> Class4
Class1 -[#green,dotted]-> Class5 
Class1 -[#0000ff,hidden]-> Class6
Class1 -[#gold,plain]-> Class7

@enduml

 

Above snippet generate below diagram.

 



  

Previous                                                    Next                                                    Home

No comments:

Post a Comment