Monday 11 March 2024

PlantUML: add inline color to the states in state diagram

Using #color notation, we can apply colors to the state diagram.

inlineColor.txt

@startuml

left to right direction

state state1 #FF9876
state state2 #lightblue
state state3 #palegreen
state state4 #brown
state state5 #magenta

[*] --> state1
state1 --> state2
state2 --> state3
state3 --> state4
state4 --> state5
state5 --> [*]


@enduml

Above snippet generate below diagram.

 


 

You can apply two colors on the state to get color gradient affects.

 

colorGradient.txt

@startuml

left to right direction

state "initialization state" as state1 #red-green
state "running state" as state2 #green|blue

[*] --> state1
state1 --> state2
state2 --> [*]


@enduml

Above snippet generate below diagram.



  

Previous                                                    Next                                                    Home

No comments:

Post a Comment