繁体   English   中英

我们可以用不同的颜色格式化plantuml的决策树部分吗

[英]Can we format the decision tree part of plantuml with a different color

我试图将植物的一部分放在 if else 条件为不同颜色的地方。 我知道像下面这样的 plantUml 可用于为 end states 着色,但我正在尝试为plantUml 中的决策部分(if 块)着色。 那可能吗?

@startuml
if (color it) then (yes)
  #Orange: Colored;
else (no)
   : Not Colored;
endif;
@enduml

问题不是 100% 清楚,有你想要的图片可能会更好。 从我看到的解决方案:

@startuml
if (color it) then (yes)
  #Orange: Colored;
else (no)
  #Transparent : Not Colored;
endif;
@enduml

在此处输入图片说明

编辑:重新审视这个问题后,我认为它有点清楚。 可能是您想使用skinparamerskinparam ActivityDiamondBackgroundColor green这样得到:

@startuml
skinparam ActivityDiamondBackgroundColor green
if (color it) then (yes)
  #Orange: Colored;
else (no)
  #Transparent : Not Colored;
endif;
@enduml

导致: 在此处输入图片说明

正如 albert 所建议的, skinparam ActivityDiamondBackgroundColor 可以是一个解决方案,但它有一个缺点,它更新图中的所有 if 元素:

@startuml
skinparam ActivityDiamondBackgroundColor green
if (color it) then (yes)
  #Orange: Colored;
else (no)
  #Transparent : Not Colored;
endif;
if (default color) then (yea)
 :Ok;
endif
@enduml

在此处输入图片说明

还有另一种方法可以仅在 if 菱形中的文本下更新背景颜色:

@startuml
if (<back:green>color it) then (yes)
  #Orange: Colored;
else (no)
  #Transparent : Not Colored;
endif;
if (default color) then (yea)
 :Ok;
endif
@enduml

对我来说,这看起来很草率。 但这是我所知道的为单个 if-钻石着色的唯一方法。

在此处输入图片说明

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM