主题

Brett Schwarz的工作之后,我们已经将几个主题整合到主核心库中

由于这些主题被包含在库中,它是开箱即用的:你不需要在你那边安装任何东西。 你只需要使用!theme 指令。

🎉 Copied!

@startuml
!theme spacelab
class Example {
  Theme spacelab
}
@enduml

🎉 Copied!

@startuml
!theme spacelab
a -> b
b -> c
@enduml

可用主题列表

下述网址列出了PlantUML库中的可用主题:

当然, 你可以用如下命令列出当前plantuml库的自带主题

🎉 Copied!

@startuml
help themes
@enduml

为消息着色,并在某些主题上包含一些过程

一些主题包含某些用以帮助为消息着色的程序,例如:
  • $success("<msg>")
  • $failure("<msg>")
  • $warning("<msg>")

案例:

🎉 Copied!

@startuml
!theme spacelab
Bob -> Alice :  hello
Bob <- Alice :  $success("success: hello B.")
Bob -x Alice :  $failure("failure")
Bob ->> Alice : $warning("warning")
@enduml

本地主题

您可以在本地文件系统上创建自己的主题。您可以在duplicate any existing theme上面创建一个属于你自己的主题.

默认情况下,主题文件名为 puml theme foo.puml 其中 foo 是主题的名称。

要调用本地主题,必须使用以下指令:

!theme foo from /path/to/themes/folder

来自互联网的主题

其他资源库也可以为PlantUML发布主题。

主题文件必须遵循相同的惯例:puml-theme-foo.puml 其中foo 是主题的名称。

要使用来自远程资源库的主题,你必须使用以下指令。

!theme amiga from https://raw.githubusercontent.com/plantuml/plantuml/master/themes

如果你发现任何有趣的主题,你也可以提出一个拉动请求,以便我们将这个主题整合到主核心库中


Privacy Policy      Advertise