Colors

You can use specify fill and line colors either: * with its standard name or CSS name * using HEX value (6 digits): #RRGGBB * using HEX value (8 digits) with alpha compositing or RGBA color model: #RRGGBBaa * using short HEX value (3 digits): #RGB (so #ABC means #AABBCC) * using very short HEX value (1 digits): #x which is a shortcut for #xxxxxx (so you get some gray)

A special color values: transparent can be used, synonym of transparent black (#00000000).

Example on link::gantt-diagram[Gantt Diagram]:

@startgantt
[Activity1] lasts 5 days
[Activity2] lasts 5 days
[Activity1] is colored in White/Red
[Activity2] is colored in Silver/SeaGreen
[Activity1] -> [Activity2]
@endgantt

Example on link::sequence-diagram[Sequence Diagram]:

@startuml
actor Bob #Red/Yellow
actor Alice #FF0000/FFFF00
Alice -> Bob : hello
@enduml

This uses Color Gradient, see next section. See also skinparam.

Color gradient

You can also use color gradient in background, with the following syntax: two colors names separated either by:

  • |,

  • /,

  • \, or

  • -

depending the direction of the gradient.

See the previous section, and link::class-diagram#cfe920390b501516[Color gradient on Class diagram page.]

Automatic font color

The special value automatic can be used for font (text foreground) color. In that case, the color is either black or white, depending on the current background.

@startuml
skinparam classFontColor automatic
skinparam classHeaderBackgroundColor #444

class classA {
testMethodCode()
}

class classB #fff {
testMethodCode()
}
@enduml

Color with preprocessing

You can manipulate color with link::preprocessing[Preprocessing], and the link::preprocessing#291cabbe982ff775[Builtin functions]:

Name Description Example Return

%darken

Return a darken color of a given color with some ratio

%darken("red", 20)

#CC0000

%is_dark

Check if a color is a dark one

%is_dark("#000000")

true

%is_light

Check if a color is a light one

%is_light("#000000")

false

%lighten

Return a lighten color of a given color with some ratio

%lighten("red", 20)

#CC3333

%reverse_color

Reverse a color using RGB

%reverse_color("#FF7700")

#0088FF

%reverse_hsluv_color

Reverse a color using HSLuv

%reverse_hsluv_color("#FF7700")

#602800

View colors in PlantUML

A user has recently created an image to display all names colors used by PlantUML. (We thank him by the way!)

So a new feature has been added to print all those colors using a special diagram description:

@startuml
colors
@enduml

It is also possible to print a palette of colors close to some other color (using its name or HEX value).

@startuml
colors chocolate
@enduml

Archimate colors

link::archimate-diagram[Archimate] uses color names that reflect the purpose of a node: * Application * Business * Implementation * Motivation * Physical * Strategy * Technology

@startuml
skinparam minClassWidth 125
skinparam nodesep 10
skinparam ranksep 10

rectangle Application    #Application
rectangle Business       #Business
rectangle Implementation #Implementation
rectangle Motivation     #Motivation
rectangle Physical       #Physical
rectangle Strategy       #Strategy
rectangle Technology     #Technology
@enduml

PlantUML colors

@startuml
skinparam minClassWidth 200
skinparam nodesep 10
skinparam ranksep 10

rectangle "ClassColor" {
rectangle "Class_C_Background\n #ADD1B2" #ADD1B2
rectangle "Class_N_Background\n #E3664A" #E3664A
rectangle "Class_A_Background\n #A9DCDF" #A9DCDF
rectangle "Class_I_Background\n #B4A7E5" #B4A7E5
rectangle "Class_E_Background\n #EB937F" #EB937F
}
rectangle "DefaultColor" {
rectangle "BackGroundColor_Default\n #FEFECE" #FEFECE
rectangle "LineColor_Default\n #A80036"       #A80036
rectangle "Legend_BackGroundColor\n #DDDDDD"   #DDDDDD
rectangle "//TBC//\n..."
}
@enduml