Thursday 11 April 2024

PlantUML: Customize style or rendering of yaml document using style tag

Using <style> tag, we can customize the font color, styles, arrow color and styles etc.,

styleTag.txt

@startyaml

<style>
yamlDiagram {
	node {
		BackGroundColor silver
		LineColor red
		FontName Helvetica
		FontColor blue
		FontSize 12
		FontStyle italic
		RoundCorner 5
		LineThickness 1
		LineStyle 10;5
		separator {
			LineThickness 0.5
			LineColor brown
			LineStyle 1;5
		}
	}

	arrow {
		BackGroundColor lightblue
		LineColor green
		LineThickness 2
		LineStyle 2;5
	}

	highlight {
		BackGroundColor green
		FontColor white
		FontStyle italic
	}
}
</style>

#highlight "name"
#highlight "address" / "city"
#highlight "hobbies" / "1"
#highlight "emails" / "0" / "id"

id: 1
name: Krishna
address:
  state: Karnatka
  city: Bnagalore
  country: India
hobbies:
- Playing cricket
- blogging

@endyaml

Above snippet generate below diagram.

 


  

Previous                                                    Next                                                    Home

No comments:

Post a Comment