Monday, 13 May 2024

PlantUML: Quick guide to skinparam command

‘skinparam’ command is used to customize the color and font of the drawing.

Let’s see it with an example.

 

helloworld.txt

@startuml

skinparam ActivityBackgroundColor LightSeaGreen
skinparam ActivityBarColor Red
skinparam ActivityBorderColor Purple
skinparam ActivityBorderThickness 3
skinparam activityDiamondBackgroundColor Sienna
skinparam activityDiamondBorderColor Red
skinparam ActivityFontStyle italic
skinparam ActivityFontSize 18
skinparam ActivityFontName Papyrus

start

partition partition1{
	:activity1;
	:activity2;
	:activity3;
}

partition partition2{
	:activity4;
	:activity5;
	:activity6;
}

stop

@enduml

Above snippet generate below diagram.



To avoid repetition of skinparam commands, you can write them in nested notation.

skinparam xxxxParam1 value1
skinparam xxxxParam2 value2

is equivalent to below notation

skinparam xxxx {
	Param1 value1
	Param2 value2
}

Let’s write helloworld application using nested notation.

 

nestedNotation.txt

@startuml

skinparam Activity{
	BackgroundColor LightSeaGreen
	BarColor Red
	BorderColor Purple
	BorderThickness 3
	DiamondBackgroundColor Sienna
	DiamondBorderColor Red
	FontStyle italic
	FontSize 18
	FontName Papyrus
}

start

partition partition1{
	:activity1;
	:activity2;
	:activity3;
}

partition partition2{
	:activity4;
	:activity5;
	:activity6;
}

stop

@enduml

  

Previous                                                    Next                                                    Home

No comments:

Post a Comment