C4-PlantUML
C4-PlantUML copied to clipboard
Ability to add styles for System_Boundary, Container_Boundary
Add support to style System_Boundary, Container_Boundary
Styling all boundaries
The style of all boundaries can already be changed by using skinparam
and the <<boundary>>
stereotype:
|
Styling individual boundaries
Although it is currently not possible to style individual boundaries as one would for elements (using UpdateElementStyle
), it is possible by setting a $tags
and changing the skinparam
for the tag`s stereotype:
|
@vellala2000 does this suffice for your usecase, or is there something else you need?
[Updated]
I re-checked the current implementation and UpdateElementStyle("boundary", ...)
and AddElementTag()
support basically boundaries (incl. legend support). There are only few limitations
- no sprites are displayed (node specific, not supported at all)
- missing explicit AddBoundaryTag() and UpdateBoundaryStyle() calls; ...Element... calls can be used as workaround
- "non-tagged" boundaries are not added to the legend (if it is not updated); possible workaround see in following sample
- boundaries in legend are not marked as
(dashed, transparent?)
(rounded box is an additional style in case of boundaries), $legendText=... can be used as workaround - $techn=... (is $type like System) of the tags is not support, there is no workaround atm
@startuml
!include <C4/C4_Container>
' workaround missing default boundary legend entry - should be part of C4 files -------------------
UpdateElementStyle("boundary", $bgColor=$BOUNDARY_BG_COLOR, $fontColor=$BOUNDARY_COLOR, $borderColor=$BOUNDARY_COLOR)
!$tagDefaultLegend = $tagDefaultLegend + "\nboundary"
' automatic add of ` (dashed, transparent?)` in legend is missing; $legendText=... could be used as workaround
' end of fix -------------------
' missing UpdateBoundaryStyle() and AddBoundaryTag() has to be simulated with ...Element...() calls
UpdateElementStyle("boundary", $bgColor="gold", $fontColor="brown", $borderColor="brown")
AddElementTag("special", $bgColor="green", $fontColor="white", $borderColor="blue", $shadowing="true", $shape = RoundedBoxShape(), $techn="A SPECIAL SYSTEM BOUNDARY", $legendText="special system boundary")
AddElementTag("existingContainersBoundary", $bgColor="red", $fontColor="white", $borderColor="white", $shape = RoundedBoxShape(), $techn="A SPECIAL SYSTEM BOUNDARY", $legendText="existing containers boundary")
System_Boundary(sb, "A System Boundary") {
}
System_Boundary(sb1, "Special System 1 Boundary", $tags="special") {
Container_Boundary(cb1, "Container Boundary\nwith tag", $tags="existingContainersBoundary") {
Container(e1, "existing 1", "xyz")
Container(e2, "existing 2", "xyz")
}
Container_Boundary(cb2, "Container_Boundary") {
Container(c2, "Container", "xyz")
}
}
System_Boundary(sb2, "Special System 2 Boundary", $tags="special") {
}
Lay_R(sb, sb1)
Lay_R(sb1, sb2)
SHOW_LEGEND()
@enduml
I think I could fix missing Add....Tag()
and UpdateBoundaryStyle()
calls (2) and missing legend entry (3, 4).
But I think we should not support sprites at all (1).
@vellala2000 and @Potherca: what do you think? Did I oversee something?
Best regards Helmut
I think I could fix missing Add....Tag() and UpdateBoundaryStyle() calls (2) and missing legend entry (3, 4).
For the sake of consistency (or principle of least surprise, I think that would be a Good Idea:tm:
I think we should not support sprites at all (1).
Agreed.
Did I oversee something?
As usual, I think you got it spot-on.
Hi @Potherca and @vellala2000 I added a better style support for border tags, can you please review my PR #231 Thank you and best regards Helmut