In an attempt to improve PlantUML documentation...
Wiki Toc Recent changes View page history Add new chapter Reorder page Raw
Defining and using spritesA Sprite is a small graphic element that can be used in diagrams. In PlantUML, sprites are monochrome and can have either 4, 8 or 16 gray level. To define a sprite, you have to use a hexadecimal digit between 0 and F per pixel. Then you can use the sprite using<$XXX>
where XXX is the name of the sprite.
You can scale the sprite.
| ||
Changing colorsAlthough sprites are monochrome, it's possible to change their color.
| ||
Encoding SpriteTo encode sprite, you can use the command line like:
where foo.png is the image file you want to use
(it will be converted to gray automatically).
After -encodesprite , you have to specify a format:
4, 8, 16, 4z, 8z or 16z .
The number indicates the gray level and the optional z is
used to enable compression in sprite definition.
| ||
Importing SpriteYou can also launch the GUI to generate a sprite from an existing image. Click in the menubar then onFile/Open Sprite Window .
After copying an image into you clipboard, several possible definitions of the corresponding sprite will be
displayed : you will just have to pickup the one you want.
| ||
Examples
| ||
StdLibThe PlantUML StdLib includes a number of ready icons in various IT areas such as architecture, cloud services, logos etc. It including AWS, Azure, Kubernetes, C4, product Logos and many others. To explore these libraries:
| ||
Listing SpritesYou can use thelistsprites command to show available sprites:
Most collections have files called all that allow you to see a whole sub-collection at once.
Else you need to find the sprites that interest you and include them one by one.
Unfortunately, the version of a collection included in StdLib often does not have such all files,
so as you see above we include the collection from github, not from StdLib.
All sprites are in grayscale, but most collections define specific macros that include appropriate (vendor-specific) colors.
| ||