Tuesday, 8 August 2023

PlantUML Package Style Customization

At the time of writing this post, following package styles are supported.

 

a.   Node

b.   Rectangle

c.    Folder

d.   Frame

e.   Cloud

f.     Database

 

You can specify the package style in two notations.

a.   Using a stereotype on the package

b.   Using the command ‘skinparam packageStyle’

 

Using a stereotype on the package

 

packageStyle1.txt

@startuml
	scale 1000 width

	package "java.lang" <<Node>> {
		class Class1
	}

	package "java.util" <<Rectangle>> {
		class Class2
	}

	package "java.awt" <<Folder>> {
		class Class3
	}

	package "javax.swing" <<Frame>> {
		class Class4
	}

	package "java.net" <<Cloud>> {
		class Class5
	}

	package "javax.json" <<Database>> {
		class Class6
	}

@enduml

 

Above snippet generate below diagram.

 

 


Using the command ‘skinparam packageStyle’

 

packageStyle2.txt

@startuml
	scale 1000 width

	skinparam packageStyle Node
	package "java.lang" {
		class Class1
	}

	skinparam packageStyle Rectangle
	package "java.util" {
		class Class2
	}

	skinparam packageStyle Folder
	package "java.awt" {
		class Class3
	}

	skinparam packageStyle Frame
	package "javax.swing" {
		class Class4
	}

	skinparam packageStyle Cloud
	package "java.net" {
		class Class5
	}

	skinparam packageStyle Database
	package "javax.json" {
		class Class6
	}

@enduml

 

Above snippet generate below diagram.

 


  

Previous                                                    Next                                                    Home

No comments:

Post a Comment