plantuml-stdlib / gilbarbara-plantuml-sprites

PlantUML sprites generated from https://github.com/gilbarbara/logos
MIT License
64 stars 20 forks source link

gilbarbara-plantuml-sprites

This repository contains PlantUML sprites generated from Gil Barbara's logos, which can easily be used in PlantUML diagrams for nice visual aid.

This project is inspired in other PlantUML sprites repositories like AWS-PlantUML and PlantUML Icon-Font Sprites. Check PlantUML stdlib for a list of other similar repositories included by default by PlantUML.

Usage

Just import the proper sprite into your PlantUML diagram and use it like any other sprite.

Example:

@startuml

!define SPRITESURL https://raw.githubusercontent.com/plantuml-stdlib/gilbarbara-plantuml-sprites/v1.1/sprites
!includeurl SPRITESURL/flask.puml
!includeurl SPRITESURL/kafka.puml
!includeurl SPRITESURL/kotlin.puml
!includeurl SPRITESURL/cassandra.puml

title Gil Barbara's logos example

skinparam monochrome true

rectangle "<$flask>\nwebapp" as webapp
queue "<$kafka>" as kafka
rectangle "<$kotlin>\ndaemon" as daemon
database "<$cassandra>" as cassandra

webapp -> kafka
kafka -> daemon
daemon --> cassandra 

@enduml

Example

The list of available sprites is here.

You can play around and test ideas with Online PlantUML Editor.

Color

To use color with the logos, there are two options:

  1. Use a sprite with the color property set
  2. Include the original PNG the sprite is based on
@startuml

!define SPRITESURL https://raw.githubusercontent.com/plantuml-stdlib/gilbarbara-plantuml-sprites/v1.1/sprites
!define IMAGESSURL https://raw.githubusercontent.com/plantuml-stdlib/gilbarbara-plantuml-sprites/v1.1/pngs
!includeurl SPRITESURL/github-octocat.puml

component "<$github-octocat> Regular Sprite" as A
component "<$github-octocat,color=#7EBDE7> Colored Sprite" as B
component "<img:IMAGESSURL/github-octocat.png> PNG Image" as C

@enduml

Color Example

Build

Sprites are built with provided svgsFolderUrl2plantUmlSprites.groovy script. To update sprites from icons in Gil Barbara's repo just re-run:

./svgsFolderUrl2plantUmlSprites.groovy https://github.com/gilbarbara/logos/tree/main/logos

Docker

In order to execute the build script within a Docker container, you may use the following command:

docker run -it --rm -v "$PWD:/home/groovy/scripts" -w /home/groovy/scripts groovy:4.0-jdk8 groovy svgsFolderUrl2plantUmlSprites.groovy https://github.com/gilbarbara/logos/tree/main/logos

Note