PlantUML Pleasantness: Using AWS, Font Awesome, Devicons and Google Material Icons

In a previous post we learned how to use the built-in icons from the OpenIconic set. In the newer PlantUML versions several icon sets have been added as standard library. These sets include AWS icons, Font Awesome icons, Devicons and Google Material icons.

To use an icon from the icon set we must include the icon using the !include statement. In our PlantUML definition we reference the icon with the syntax <$iconName>. In the following example PlantUML definition we include 2 icons from the Font Awesome and Devicons icon sets:

When we render this definition to a diagram we get the following result:

Each icon set also comes with a common file that defines macros for creating elements with an icon. Instead of referencing an icon with the syntax <$iconName> we can use a macro. For each icon there is a corresponding macro and the macro is overloaded to accept different arguments. The icon sets for AWS, Font Awesome and Devicons use the same macro arguments. The arguments for using the Google Material icons is different. So we need to keep this in mind when we use the macros in our PlantUML definition.

We use the macros from the different icon sets n the following examples:

Let’s render the diagram for the PlantUML definition:

In the next example we use the extra arguments to style the element. Also we use the stereotype set by the macro to change the foreground and background colors of the element:

We get the following diagram:

Now we use the AWS icons:

This results in the following diagram:

And with the Google Material icon set we must keep in mind that the arguments for the macros are different:

The definition gives the following diagram:

Written with PlantUML 1.2018.6.

Original post

This entry was posted in PlantUML by mrhaki. Bookmark the permalink.

About mrhaki

My name is Hubert A. Klein Ikkink also known as mrhaki. I work at the great IT company JDriven. Here I work on projects with Groovy & Grails, Gradle and Spring. At JDriven we focus on SpringSource technologies. All colleagues want to learn new technologies, support craftmanship and are very eager to learn. This is truly a great environment to work in. You can contact me via Google+ or @mrhaki.

Leave a Reply

Your email address will not be published. Required fields are marked *