Colour and styling

Colour participants, boxes, notes, messages and fragments in sequence code, and style the text in labels.

Colour is written the way PlantUML writes it, after the thing it colours. Text can be styled as in Markdown. To colour without writing code, see Colour.

Colour

actor Shopper #pink
participant Shop API as API #blue
box "Backend" #green
  participant Payments
end box

Shopper-[#orange]>API: Pay
API-[#red]->Shopper: Declined
note over Shopper, API #yellow: Card details stay in the browser
alt#green card ok
  API->Payments: Charge
else declined
  API-->Shopper: Declined
end

A colour is a hash and one of these:

  • A colour name: #red, #orange, #yellow, #green, #blue, #purple, #pink or #grey, in any case.
  • A CSS colour name, such as #lightblue, #teal or #mistyrose. A CSS name is its CSS shade, and the app writes it back as its hex.
  • A hex colour, #RGB or #RRGGBB.

Where the colour goes depends on the element:

ElementColour goesExample
ParticipantAfter its name or aliasparticipant Shop API as API #blue
BoxAfter its labelbox "Backend" #green
NoteAfter the participants it's onnote over Shopper, API #yellow: text
MessageInside its arrowA -[#orange]> B for a call, A -[#red]-> B for a reply, A -[#purple]>> B for an async message
FragmentGlued to its keywordalt#green card ok, loop#blue each item

Activation bars, dividers, delays and refs have no colour.

How colours are drawn

The app draws a colour as an outline or line in the colour, with a faint wash of it inside. Text stays as it is, so it reads the same in every colour, in the light and the dark theme.

The app offers eight colours:

NameHex
red#E74C3C
orange#E67E22
yellow#F1C40F
green#27AE60
blue#3498DB
purple#8E44AD
pink#E84393
grey#7F8C8D

#gray works too. A name is the palette's colour, not the shade PlantUML gives the word. A hex that is one of the eight is written back by its name. Any other hex colour is drawn as it is. The PlantUML and Mermaid files always have the hex.

What the app reads past

A colour inside an arrow keeps the colour. The app reads past the rest of PlantUML's arrow styling, such as -[#red,dashed]> or -[bold]->. The same goes for sequencediagram.org's -#red> and -#red:3>.

A fragment's background colour after its tab colour, as in alt#Gold #LightYellow card ok, is read past too. Only the tab colour is drawn.

Names that look like colours

A name that ends in something that reads as a colour, such as Ticket #123 or Team #pink, goes in quotes: participant "Ticket #123" as T. A fragment's colour is glued to its keyword, so a condition never reads as one.

Text styling

note over Shop: Check **instructions** and *examples*
Shop->API: Call `POST /orders`

Message, note and ref text can be styled as in Markdown: **bold**, *italic*, `code` and ~~struck~~. sequencediagram.org's //italic// and ""code"" work too. Box labels are styled the same way.

Code is drawn in the code font, rose on a faint box. See Rename and style text.

Text tags from other tools

PlantUML's and sequencediagram.org's text tags are drawn without the tags:

  • <b>, <i>, <u> and <s> style the text.
  • <color:red>…</color> colours it, darkened or lightened if needed so it stays readable on its background.
  • Tags that only change size, font, alignment or background, such as <size:9>, are left out of the drawing. So are icon tags. The text inside them is kept.

On this page