The steps to add an icon library are:
- Generate PlantUML sprite files
- Put all of the sprites in a repo
- Open an MR here to get the sprite repo included into stdLib
- Including an
INFO
file
- Including an
Generating.puml
files from a bunch of SVGs can be done using plantuml.jar -encodesprite
1
It is quite common for icon-sets to either exist out of SVGs or be generated from SVGs, so source SVGs are often already available.
Figuring out which settings to use with encodesprite
can take some trial-and-error.2
I remember looking into https://github.com/tupadr3/font-icon-generator but I can really remember how things work, so for now YMMV.
Once you have a bunch of generated .puml
files, it is a good idea to create a common/main file that includes all the sprites, to save users the hassle of having to load each sprite individually.3
Adding a README explaining things a bit is also a good move.
To add an icon library to this project (i.e.e the PlantUML stdLib), open a merge request with:4
- A folder containing all of your PlantUML sprite files
- An entry to README file
- An
INFO
file
The INFO
file should contain the version (i.e. the git tag or github release) of the icon-set you are adding and the source repo.
For instance:
VERSION=1.2.0
SOURCE=https://github.com/path-to/project
If the source repo tags newer versions when things change, updating things here can be automated.5
In the long run, it could even be possible to add/update icon-sets here without an intermediary repo, but for now, this is how it is done.
-
To quote the manual entry on sprites:
To encode sprite, you can use the command line like:
java -jar plantuml.jar -encodesprite 16z foo.png
wherefoo.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
or16z
. The number indicates the gray level and the optionalz
is used to enable compression in sprite definition. -
This blog post by Hubert Klein Ikkink might be of some help
-
Look at existing sprite sets for inspiration
-
A good example of this is #18
-
That is in fact what I have been doing for all MRs opened for this ticket