Snow Flower Text supports UML drawing in the PlantUML language. It has its own PlantUML Improvement Engine and you can begin using all UML drawing functions without additional installation.
PlantUML is an open source tool that can generate UML diagrams from plain text languages. PlantUML is designed to allow UML diagrams to be read by blind software engineers, and the PlantUML language is human readable plain text. |
1. How to use
You can embed UML in a document by writing PlantUML syntax in AsciiDoc [plantuml]
block.
Select the AsciiDoc grammar.
Use the
plantuml
block to describe PlantUML. You can insert a PlantUML template into a document from theMenu
>Insert
>UML
menu.
[plantuml]
--------------------------------------------
@startuml
class Node
class Parent
Node <-- Parent
Parent <-- Region
Region <-- Pane
Node <-- Shape
@enduml
--------------------------------------------
For details of PlantUML grammar, please refer to “PlantUML Language Reference Guide”.
2. Layout
PlantUML does not require an explicit layout, but there is a way to control the placement direction.
The default layout direction is from top to bottom. To change the orientation of the layout from left to right use the left to right direction
command.
[plantuml]
--------------------------------------------
@startuml
left to right direction
class Node
class Parent
Node <-- Parent
Parent <-- Region
Region <-- Pane
Node <-- Shape
@enduml
--------------------------------------------
You can control individually by specifying the arrangement direction in “relationship”. The placement direction is specified with the following keywords.
- up, u
Upward direction
- down, ,do, d
Under direction
- left, le, l
Left direction
- right, ri, r
Right direction
[plantuml]
---------
@startuml
Actor -u- (Up)
Actor -l- (Left)
Actor -r- (Right)
Actor -d- (Down)
@enduml
---------
3. How to describe the caption
When captions are attached to figures, Captions can be attached to diagrams using the caption
command in the PlantUML language, but this method is not recommended for AsciiDoc documents. Since it is better to designate the caption in AsciiDoc notation, it is better to describe it as AsciiDoc notation because the design of the entire document can be unified.
The following is a simple example of describing captions in PlantUML.
[plantuml]
----------------------------------------
@startuml
caption Caption
...
@enduml
----------------------------------------
The description becomes complicated when trying to unify the caption style with the document style in PlantUML as in the following example.
[plantuml]
----------------------------------------
@startuml
caption <i><color:#700>Chain-of-responsibility</color></i>
...
@enduml
----------------------------------------
The description is simplified by using the AsciiDoc notation for the caption as follows.
.Chain-of-responsibility
[plantuml]
----------------------------------------
@startuml
...
@enduml
----------------------------------------
4. How to customize the skin
If you want to change the color scheme, font family and font size of diagrams generated by PlantUML, you can change by using the skinparam command.
4.1. Monochromatization
If you want to use a simple monochrome color scheme, With the command description of ‘skinparam monochrome true’ you can easily change the color scheme of all diagrams.
[plantuml]
--------------------------------------------
@startuml
skinparam monochrome true
...
@enduml
--------------------------------------------
[plantuml]
--------------------------------------------
@startuml
skinparam monochrome reverse
...
@enduml
--------------------------------------------
4.2. Change background color
[plantuml]
-------
@startuml
skinparam backgroundColor aliceblue
...
@enduml
-------
4.3. How to change font
If you want to change the font, you can change it with the skinparam command. Although it is possible to specify the font in detail, it is complicated but we recommend a concise description method to change the font in batch by specifying the default font. You can change the default font by specifying the following command.
skinparam defaultFontname FontFamilyName
Changing the font name increases system dependency, so you need to be careful in choosing fonts. However, as with CSS on the Web, there is a fallback behavior of fonts, so you can reduce the dependency with an approach that specifies multiple fonts just like the Web. This method automatically adjusts the width of the text depending on the display environment even in environments where there is no specified metrics compatible font.
Here is an example of sans-serif, serif, and monotype.
[plantuml]
-------
@startuml
skinparam defaultFontName "Helvetica Neue, Helvetica,Arial,sans-serif"
...
@enduml
-------
Metric compatible font” is a font whose metrics match. The layout of the document will not be lost even if the font is replaced because the metrics (character size) match. |
Helvetica, Arial, Liberation Sans
Times, Times New Roman, Liberation Serif
Courier, Courier New, Liberation Mono
4.4. How to specify color
As with CSS on the Web in PlantUML You can specify colors with standard color names or RGB HEX codes.
The following standard color names can be used. Color names are not case sensitive.
Whites
■ antiquewhite
■ azure
■ bisque
■ blanchedalmond
■ cornsilk
■ oralwhite
■ gainsboro
■ ghostwhite
■ honeydew
■ ivory
■ lavender
■ lavenderblush
■ lemonchiffon
■ linen
■ mintcream
■ mistyrose
■ moccasin
■ navajowhite
■ oldlace
■ papayawhip
■ peachpuff
■ seashell
■ snow
■ thistle
■ wheat
■ white
■ whitesmoke
Greys
■ darkslategray
■ dimgray
■ gray
■ gray
■ lightgray
■ lightslategray
■ slategray
Blacks
■ black
Reds
■ coral
■ crimson
■ darksalmon
■ deeppink
■ rebrick
■ hotpink
■ indianred
■ lightpink
■ lightsalmon
■ maroon
■ mediumvioletred
■ orangered
■ palevioletred
■ pink
■ red
■ salmon
■ tomato
■ violetred
Browns
■ beige
■ brown
■ burlywood
■ chocolate
■ darkkhaki
■ khaki
■ peru
■ rosybrown
■ saddlebrown
■ sandybrown
■ sienna
■ tan
Oranges
■ darkorange
■ orange
■ orangered
Yellows
■ darkgoldenrod
■ gold
■ goldenrod
■ greenyellow
■ lightgoldenrod
■ lightgoldenrodyellow
■ lightyellow
■ palegoldenrod
■ yellow
■ yellowgreen
Greens
■ chartreuse
■ darkgreen
■ darkolivegreen
■ darkseagreen
■ forestgreen
■ green
■ greenyellow
■ lawngreen
■ lightseagreen
■ limegreen
■ mediumseagreen
■ mediumspringgreen
■ mintcream
■ olivedrab
■ palegreen
■ seagreen
■ springgreen
■ yellowgreen
■ Cyans
■ aquamarine
■ cyan
■ darkturquoise
■ lightcyan
■ mediumaquamarine
■ mediumturquoise
■ paleturquoise
■ turquoise
Blues
■ aliceblue
■ blue
■ blueviolet
■ cadetblue
■ corn
■ owerblue
■ darkslateblue
■ deepskyblue
■ dodgerblue
■ indigo
■ lightblue
■ lightskyblue
■ lightslateblue
■ mediumblue
■ mediumslateblue
■ midnightblue
■ navy
■ navyblue
■ powderblue
■ royalblue
■ skyblue
■ slateblue
■ steelblue
Magentas
■ blueviolet
■ darkorchid
■ darkviolet
■ magenta
■ mediumorchid
■ mediumpurple
■ mediumvioletred
■ orchid
■ palevioletred
■ plum
■ purple
■ violet
■ violetred