11' C4-PlantUML
2-
2+
33' Global pre-settings
44' ##################################
5+ ' NEW_C4_STYLE
6+ ' If NEW_C4_STYLE is set BEFORE the first C4_* file is loaded, new C4 layout style is used
7+ ' NEW_C4_STYLE can be set via
8+ ' !NEW_C4_STYLE = 1
9+ ' or with additional command line argument -DNEW_C4_STYLE=1
10+ !global NEW_C4_STYLE ?= 0
11+
512' ENABLE_ALL_PLANT_ELEMENTS
613' If ENABLE_ALL_PLANT_ELEMENTS is set BEFORE the first C4_* file is loaded, nearly "all" PlantUML elements can be used like
714' Component(StorageA, "Storage A ", $baseShape="storage")
815' ENABLE_ALL_PLANT_ELEMENTS can be set via
916' !ENABLE_ALL_PLANT_ELEMENTS = 1
1017' or with additional command line argument -DENABLE_ALL_PLANT_ELEMENTS=1
1118
19+ ' NO_LAY_ROTATE
1220' C4-PlantUML v2.12 fixed a missing rotation bug in Lay_* calls in combination with LAYOUT_LANDSCAPE() call
1321' (details see https://github.com/plantuml-stdlib/C4-PlantUML/issues/376)
1422' If older diagrams should remain unchanged the bugfix can be deactivated with following statement
@@ -73,6 +81,7 @@ rectangle C4VersionDetailsArea <<legendArea>> [
7381!$LEGEND_NO_FONT_TEXT ?= "last text color "
7482!$LEGEND_NO_BG_TEXT ?= "last back color "
7583!$LEGEND_NO_LINE_TEXT ?= "last line color "
84+ !$LEGEND_SHARP_CORNER ?= "box "
7685!$LEGEND_ROUNDED_BOX ?= "rounded box "
7786!$LEGEND_EIGHT_SIDED ?= "eight sided "
7887!$LEGEND_DOTTED_LINE ?= "dotted "
@@ -129,8 +138,14 @@ rectangle C4VersionDetailsArea <<legendArea>> [
129138' internal
130139' ##################################
131140
141+ !global $SHARP_CORNER = "sharpCorner "
132142!global $ROUNDED_BOX = "roundedBox "
133143!global $EIGHT_SIDED = "eightSided "
144+ !if (NEW_C4_STYLE == 1 )
145+ !$DEFAULT_SHAPE ?= $ROUNDED_BOX
146+ !else
147+ !$DEFAULT_SHAPE ?= $SHARP_CORNER
148+ !endif
134149
135150!global $DOTTED_LINE = "dotted "
136151!global $DASHED_LINE = "dashed "
@@ -445,7 +460,10 @@ skinparam package {
445460 !endif
446461 ' only rectangle supports shape(d corners), define both skinparam that overlays are working
447462 !if ($shape != "" && $element == "rectangle ")
448- !if ($shape == $ROUNDED_BOX )
463+ !if ($shape == $SHARP_CORNER )
464+ !$elementSkin = $elementSkin + " RoundCorner " + "0 " + $bl ()
465+ !$elementSkin = $elementSkin + " DiagonalCorner " + "0 " + $bl ()
466+ !else if ($shape == $ROUNDED_BOX )
449467 !$elementSkin = $elementSkin + " RoundCorner " + $ROUNDED_BOX_SIZE + $bl ()
450468 !$elementSkin = $elementSkin + " DiagonalCorner " + "0 " + $bl ()
451469 !else if ($shape == $EIGHT_SIDED )
@@ -744,10 +762,13 @@ $elementSkin
744762 !if ($shadowing == "false ")
745763 !$tagDetails = $tagDetails + $LEGEND_NO_SHADOW_TEXT + ", "
746764 !endif
747- !if ($shape == $ROUNDED_BOX )
765+ !if ($shape == $SHARP_CORNER && $shape != $DEFAULT_SHAPE )
766+ !$tagDetails = $tagDetails + $LEGEND_SHARP_CORNER + ", "
767+ !endif
768+ !if ($shape == $ROUNDED_BOX && $shape != $DEFAULT_SHAPE )
748769 !$tagDetails = $tagDetails + $LEGEND_ROUNDED_BOX + ", "
749770 !endif
750- !if ($shape == $EIGHT_SIDED )
771+ !if ($shape == $EIGHT_SIDED && $ shape ! = $ DEFAULT_SHAPE )
751772 !$tagDetails = $tagDetails + $LEGEND_EIGHT_SIDED + ", "
752773 !endif
753774 !if ($fontColor == "" && $bgColor == "")
@@ -940,6 +961,11 @@ $line
940961 !endif
941962!endprocedure
942963
964+ ' normal rectangle
965+ !function SharpCornerShape ()
966+ !return $SHARP_CORNER
967+ !endfunction
968+
943969!function RoundedBoxShape ()
944970!return $ROUNDED_BOX
945971!endfunction
@@ -966,6 +992,14 @@ $line
966992
967993' used by new defined tags
968994!unquoted procedure AddElementTag ($tagStereo , $bgColor = "", $fontColor = "", $borderColor = "", $shadowing = "", $shape = "", $sprite = "", $techn = "", $legendText = "", $legendSprite = "", $borderStyle = "", $borderThickness = "")
995+
996+ !if (NEW_C4_STYLE == 1 )
997+ !$swap = $bgColor
998+ !$bgColor = $fontColor
999+ !$fontColor = $swap
1000+ !$borderColor = $swap
1001+ !endif
1002+
9691003$defineSkinparams ($tagStereo , $bgColor , $fontColor , $borderColor , $shadowing , $shape , $borderStyle , $borderThickness )
9701004 !if ($sprite != "")
9711005%set_variable_value ("$" + $tagStereo + "ElementTagSprite" , $sprite )
@@ -980,6 +1014,15 @@ $addTagToLegend($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $sha
9801014!endprocedure
9811015
9821016!unquoted procedure $addElementTagInclReuse ($elementName , $tagStereo , $bgColor = "", $fontColor = "", $borderColor = "", $shadowing = "", $shape = "", $sprite = "", $techn = "", $legendText = "", $legendSprite = "", $borderStyle = "", $borderThickness = "")
1017+
1018+ 'stored tags are already swapped (swap before comparing)
1019+ !if (NEW_C4_STYLE == 1 )
1020+ !$swap = $bgColor
1021+ !$bgColor = $fontColor
1022+ !$fontColor = $swap
1023+ !$borderColor = $swap
1024+ !endif
1025+
9831026 !$bgColor = $restoreEmpty ($elementName , "bgColor ", $bgColor , %false ())
9841027 !$fontColor = $restoreEmpty ($elementName , "fontColor ", $fontColor , %false ())
9851028 !$borderColor = $restoreEmpty ($elementName , "borderColor ", $borderColor , %false ())
@@ -993,6 +1036,14 @@ $addTagToLegend($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing, $sha
9931036 !$borderStyle = $restoreEmpty ($elementName , "borderStyle ", $borderStyle , %false ())
9941037 !$borderThickness = $restoreEmpty ($elementName , "borderThickness ", $borderThickness , %false ())
9951038
1039+ ' swap back
1040+ !if (NEW_C4_STYLE == 1 )
1041+ !$swap = $bgColor
1042+ !$bgColor = $fontColor
1043+ !$fontColor = $swap
1044+ !$borderColor = $swap
1045+ !endif
1046+
9961047 AddElementTag ($tagStereo , $bgColor , $fontColor , $borderColor , $shadowing , $shape , $sprite , $techn , $legendText , $legendSprite , $borderStyle , $borderThickness )
9971048!endprocedure
9981049
@@ -1014,6 +1065,14 @@ $addRelTagToLegend($tagStereo, $textColor, $lineColor, $lineStyle, $legendText,
10141065
10151066' update the style of existing elements like person, ...
10161067!unquoted procedure UpdateElementStyle ($elementName , $bgColor = "", $fontColor = "", $borderColor = "", $shadowing = "", $shape = "", $sprite = "", $techn = "", $legendText = "", $legendSprite = "", $borderStyle = "", $borderThickness = "")
1068+
1069+ !if (NEW_C4_STYLE == 1 )
1070+ !$swap = $bgColor
1071+ !$bgColor = $fontColor
1072+ !$fontColor = $swap
1073+ !$borderColor = $swap
1074+ !endif
1075+
10171076!$bgColor = $restoreEmpty ($elementName , "bgColor ", $bgColor , %true ())
10181077!$fontColor = $restoreEmpty ($elementName , "fontColor ", $fontColor , %true ())
10191078!$borderColor = $restoreEmpty ($elementName , "borderColor ", $borderColor , %true ())
@@ -1534,6 +1593,14 @@ $getLegendArea($alias, $hideStereotype, $details)
15341593' ##################################
15351594
15361595!unquoted procedure UpdateBoundaryStyle ($elementName = "", $bgColor = "", $fontColor = "", $borderColor = "", $shadowing = "", $shape = "", $type = "", $legendText = "", $borderStyle = "", $borderThickness = "", $sprite = "", $legendSprite = "")
1596+
1597+ !if (NEW_C4_STYLE == 1 )
1598+ !$swap = $bgColor
1599+ !$bgColor = $fontColor
1600+ !$fontColor = $swap
1601+ !$borderColor = $swap
1602+ !endif
1603+
15371604 !if ($elementName != "")
15381605 !$elementBoundary = $elementName + '_boundary '
15391606 UpdateElementStyle ($elementBoundary , $bgColor , $fontColor , $borderColor , $shadowing , $shape , $sprite , $type , $legendText , $legendSprite , $borderStyle , $borderThickness )
0 commit comments