颜色

您可以指定填充色和线条颜色:

特殊颜色值: transparent 同样可以使用, 同义词是 transparent black (#00000000).

甘特图示例:

🎉 Copied!

@startgantt
[活动1] lasts 5 days
[活动2] lasts 5 days
[活动1] is colored in White/Red
[活动2] is colored in Silver/SeaGreen
[活动1] -> [活动2]
@endgantt

时序图示例:

🎉 Copied!

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

这里使用的是颜色渐变,请参阅下一节。 另参考 skinparam.

WARNING
 This translation need to be updated. 
WARNING

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 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.

🎉 Copied!

@startuml
skinparam classFontColor automatic
skinparam classHeaderBackgroundColor #444

class classA {
testMethodCode()        
}

class classB #fff {
testMethodCode()       
}
@enduml

Color with preprocessing

You can manipulate color with Preprocessing, and the 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

查看PlantUML中的颜色

一个用户最近创建了一个图片来显示PlantUML使用的所有名字的颜色。(我们顺便感谢他!)

所以我们增加了一个新的功能,用一个特殊的图示描述来打印所有这些颜色:

🎉 Copied!

@startuml
colors
@enduml

也可以打印接近其他颜色的调色板(使用其名称或HEX值)。

🎉 Copied!

@startuml
colors chocolate
@enduml

Archimate colors

Archimate uses color names that reflect the purpose of a node:
  • Application
  • Business
  • Implementation
  • Motivation
  • Physical
  • Strategy
  • Technology

🎉 Copied!

@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

🎉 Copied!

@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


Privacy Policy      Advertise