Skip to content

Commit dd0ac23

Browse files
committed
#364,365 add UpdateLegendTitle(newTitle) call and language themes
1 parent e236295 commit dd0ac23

35 files changed

+1144
-27
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
################################################################################
2+
# This .gitignore file was automatically created by Microsoft(R) Visual Studio.
3+
################################################################################
4+
5+
/.idea
6+
/.vs
7+
/.vscode

C4.puml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ rectangle C4VersionDetailsArea <<legendArea>> [
5454
' Labels
5555
' ##################################
5656

57+
!$BOUNDARY_LEGEND_TEXT ?= "boundary"
58+
59+
!$LEGEND_TITLE_TEXT ?= "Legend"
5760
!$LEGEND_SHADOW_TEXT ?= "shadow"
5861
!$LEGEND_NO_SHADOW_TEXT ?= "no shadow"
5962
!$LEGEND_NO_FONT_BG_TEXT ?= "last text and back color"
@@ -68,6 +71,9 @@ rectangle C4VersionDetailsArea <<legendArea>> [
6871
!$LEGEND_SOLID_LINE ?= "solid"
6972

7073
!$LEGEND_BOUNDARY ?= "boundary"
74+
!$LEGEND_BOUNDARY_PRE_PART ?= ""
75+
!$LEGEND_BOUNDARY_POST_PART ?= " " + $LEGEND_BOUNDARY
76+
7177
' ignore (boundary) transparent atm, that the legend is smaller
7278
' !$LEGEND_BOUNDARY_TRANSPARENT_INCL_COMA ?= "transparent, "
7379
!$LEGEND_BOUNDARY_TRANSPARENT_INCL_COMA ?= ""
@@ -692,13 +698,13 @@ $elementSkin
692698
!if (%strpos($tagStereo, "boundary") >= 0)
693699
!if ($tagStereo == "boundary")
694700
!$isBoundary = 1
695-
!$tagEntry = $tagEntry + " " + $LEGEND_BOUNDARY + " "
701+
!$tagEntry = $LEGEND_BOUNDARY_PRE_PART + $tagEntry + $LEGEND_BOUNDARY_POST_PART + " "
696702
!else
697703
' if contains/ends with _boundary remove _boundary and add "boundary (dashed)"
698704
!$pos = %strpos($tagStereo, "_boundary")
699705
!if ($pos > 0)
700706
!$isBoundary = 1
701-
!$tagEntry = $tagEntry + " " + %substr($tagStereo, 0 ,$pos) + " " +$LEGEND_BOUNDARY + " "
707+
!$tagEntry = $tagEntry + " " + $LEGEND_BOUNDARY_PRE_PART + %substr($tagStereo, 0 ,$pos) + $LEGEND_BOUNDARY_POST_PART + " "
702708
!endif
703709
!endif
704710
!endif
@@ -1027,6 +1033,10 @@ UpdateElementStyle($elementName, $bgColor, $fontColor, $borderColor, $shadowing)
10271033
$elementSkin
10281034
!endprocedure
10291035

1036+
!unquoted procedure UpdateLegendTitle($newTitle)
1037+
!$LEGEND_TITLE_TEXT = $newTitle
1038+
!endprocedure
1039+
10301040
' tags/stereotypes have to be delimited with \n
10311041
!unquoted procedure SetDefaultLegendEntries($tagStereoEntries)
10321042
!$tagDefaultLegend = $tagStereoEntries
@@ -1234,7 +1244,7 @@ hide stereotype
12341244

12351245
!procedure $getLegendTable($detailsFormat)
12361246
!global $LEGEND_DETAILS_SIZE = $getLegendDetailsSize($detailsFormat)
1237-
<$colorWithHash(transparent),$colorWithHash(transparent)>|<color:$LEGEND_TITLE_COLOR>**Legend**</color> |
1247+
<$colorWithHash(transparent),$colorWithHash(transparent)>|<color:$LEGEND_TITLE_COLOR>**$LEGEND_TITLE_TEXT **</color> |
12381248
$showActiveLegendEntries($tagDefaultLegend)
12391249
$showActiveLegendEntries($tagCustomLegend)
12401250
!endprocedure
@@ -1457,7 +1467,7 @@ rectangle "$getBoundary($label, $type, $descr, $sprite)" $toStereos("boundary",
14571467
!endprocedure
14581468

14591469
' Boundary Styling
1460-
UpdateBoundaryStyle("", $bgColor=$BOUNDARY_BG_COLOR, $fontColor=$BOUNDARY_COLOR, $borderColor=$BOUNDARY_COLOR, $borderStyle=DashedLine())
1470+
UpdateBoundaryStyle("", $bgColor=$BOUNDARY_BG_COLOR, $fontColor=$BOUNDARY_COLOR, $borderColor=$BOUNDARY_COLOR, $borderStyle=DashedLine(), $legendText="$BOUNDARY_LEGEND_TEXT")
14611471

14621472
' Index
14631473
' ##################################

C4_Component.puml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,22 @@
1717
!$COMPONENT_BG_COLOR ?= "#85BBF0"
1818
!$COMPONENT_BORDER_COLOR ?= "#78A8D8"
1919

20+
!$EXTERNAL_COMPONENT_LEGEND_TEXT ?= "external component"
2021
!$EXTERNAL_COMPONENT_FONT_COLOR ?= $COMPONENT_FONT_COLOR
2122
!$EXTERNAL_COMPONENT_BG_COLOR ?= "#CCCCCC"
2223
!$EXTERNAL_COMPONENT_BORDER_COLOR ?= "#BFBFBF"
2324

25+
' Labels
26+
' ##################################
27+
28+
!$COMPONENT_LEGEND_TEXT ?= "component"
29+
!$EXTERNAL_COMPONENT_LEGEND_TEXT ?= "external component"
30+
2431
' Styling
2532
' ##################################
2633

27-
UpdateElementStyle("component", $COMPONENT_BG_COLOR, $COMPONENT_FONT_COLOR, $COMPONENT_BORDER_COLOR)
28-
UpdateElementStyle("external_component", $EXTERNAL_COMPONENT_BG_COLOR, $EXTERNAL_COMPONENT_FONT_COLOR, $EXTERNAL_COMPONENT_BORDER_COLOR)
34+
UpdateElementStyle("component", $COMPONENT_BG_COLOR, $COMPONENT_FONT_COLOR, $COMPONENT_BORDER_COLOR, $legendText="$COMPONENT_LEGEND_TEXT")
35+
UpdateElementStyle("external_component", $EXTERNAL_COMPONENT_BG_COLOR, $EXTERNAL_COMPONENT_FONT_COLOR, $EXTERNAL_COMPONENT_BORDER_COLOR, $legendText="$EXTERNAL_COMPONENT_LEGEND_TEXT")
2936

3037
' shortcuts with default colors
3138
!unquoted procedure AddComponentTag($tagStereo, $bgColor="", $fontColor="", $borderColor="", $shadowing="", $shape="", $sprite="", $techn="", $legendText="", $legendSprite="", $borderStyle="", $borderThickness="")

C4_Container.puml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,20 @@
2525
!$EXTERNAL_CONTAINER_BG_COLOR ?= "#B3B3B3"
2626
!$EXTERNAL_CONTAINER_BORDER_COLOR ?= "#A6A6A6"
2727

28+
' Labels
29+
' ##################################
30+
31+
!$CONTAINER_LEGEND_TEXT ?= "container"
32+
!$CONTAINER_BOUNDARY_TYPE ?= "container"
33+
!$CONTAINER_BOUNDARY_LEGEND_TEXT ?= "container boundary"
34+
!$EXTERNAL_CONTAINER_LEGEND_TEXT ?= "external container"
35+
2836
' Styling
2937
' ##################################
30-
UpdateElementStyle("container", $CONTAINER_BG_COLOR, $CONTAINER_FONT_COLOR, $CONTAINER_BORDER_COLOR)
31-
UpdateElementStyle("external_container", $EXTERNAL_CONTAINER_BG_COLOR, $EXTERNAL_CONTAINER_FONT_COLOR, $EXTERNAL_CONTAINER_BORDER_COLOR)
38+
UpdateElementStyle("container", $CONTAINER_BG_COLOR, $CONTAINER_FONT_COLOR, $CONTAINER_BORDER_COLOR, $legendText="$CONTAINER_LEGEND_TEXT")
39+
UpdateElementStyle("external_container", $EXTERNAL_CONTAINER_BG_COLOR, $EXTERNAL_CONTAINER_FONT_COLOR, $EXTERNAL_CONTAINER_BORDER_COLOR, $legendText="$EXTERNAL_CONTAINER_LEGEND_TEXT")
3240

33-
UpdateBoundaryStyle("container", $bgColor=$CONTAINER_BOUNDARY_BG_COLOR, $fontColor=$CONTAINER_BOUNDARY_COLOR, $borderColor=$CONTAINER_BOUNDARY_COLOR, $type="Container")
41+
UpdateBoundaryStyle("container", $bgColor=$CONTAINER_BOUNDARY_BG_COLOR, $fontColor=$CONTAINER_BOUNDARY_COLOR, $borderColor=$CONTAINER_BOUNDARY_COLOR, $type="$CONTAINER_BOUNDARY_TYPE", $legendText="$CONTAINER_BOUNDARY_LEGEND_TEXT")
3442

3543
' shortcuts with default colors
3644
!unquoted procedure AddContainerTag($tagStereo, $bgColor="", $fontColor="", $borderColor="", $shadowing="", $shape="", $sprite="", $techn="", $legendText="", $legendSprite="", $borderStyle="", $borderThickness="")

C4_Context.puml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,30 @@
3737
!$ENTERPRISE_BOUNDARY_BG_COLOR ?= $BOUNDARY_BG_COLOR
3838
!$ENTERPRISE_BOUNDARY_BORDER_STYLE ?= $BOUNDARY_BORDER_STYLE
3939

40+
' Labels
41+
' ##################################
42+
43+
!$PERSON_LEGEND_TEXT ?= "person"
44+
!$EXTERNAL_PERSON_LEGEND_TEXT ?= "external person"
45+
46+
!$SYSTEM_LEGEND_TEXT ?= "system"
47+
!$SYSTEM_BOUNDARY_TYPE ?= "system"
48+
!$SYSTEM_BOUNDARY_LEGEND_TEXT ?= "system boundary"
49+
!$EXTERNAL_SYSTEM_LEGEND_TEXT ?= "external system"
50+
51+
!$ENTERPRISE_BOUNDARY_TYPE ?= "enterprise"
52+
!$ENTERPRISE_BOUNDARY_LEGEND_TEXT ?= "enterprise boundary"
53+
4054
' Styling
4155
' ##################################
4256

43-
UpdateElementStyle("person", $PERSON_BG_COLOR, $PERSON_FONT_COLOR, $PERSON_BORDER_COLOR)
44-
UpdateElementStyle("external_person", $EXTERNAL_PERSON_BG_COLOR, $EXTERNAL_PERSON_FONT_COLOR, $EXTERNAL_PERSON_BORDER_COLOR)
45-
UpdateElementStyle("system", $SYSTEM_BG_COLOR, $SYSTEM_FONT_COLOR, $SYSTEM_BORDER_COLOR)
46-
UpdateElementStyle("external_system", $EXTERNAL_SYSTEM_BG_COLOR, $EXTERNAL_SYSTEM_FONT_COLOR, $EXTERNAL_SYSTEM_BORDER_COLOR)
57+
UpdateElementStyle("person", $PERSON_BG_COLOR, $PERSON_FONT_COLOR, $PERSON_BORDER_COLOR, $legendText="$PERSON_LEGEND_TEXT")
58+
UpdateElementStyle("external_person", $EXTERNAL_PERSON_BG_COLOR, $EXTERNAL_PERSON_FONT_COLOR, $EXTERNAL_PERSON_BORDER_COLOR, $legendText="$EXTERNAL_PERSON_LEGEND_TEXT")
59+
UpdateElementStyle("system", $SYSTEM_BG_COLOR, $SYSTEM_FONT_COLOR, $SYSTEM_BORDER_COLOR, $legendText="$SYSTEM_LEGEND_TEXT")
60+
UpdateElementStyle("external_system", $EXTERNAL_SYSTEM_BG_COLOR, $EXTERNAL_SYSTEM_FONT_COLOR, $EXTERNAL_SYSTEM_BORDER_COLOR, $legendText="$EXTERNAL_SYSTEM_LEGEND_TEXT")
4761

48-
UpdateBoundaryStyle("system", $bgColor=$SYSTEM_BOUNDARY_BG_COLOR, $fontColor=$SYSTEM_BOUNDARY_COLOR, $borderColor=$SYSTEM_BOUNDARY_COLOR, $type="System")
49-
UpdateBoundaryStyle("enterprise", $bgColor=$ENTERPRISE_BOUNDARY_BG_COLOR, $fontColor=$ENTERPRISE_BOUNDARY_COLOR, $borderColor=$ENTERPRISE_BOUNDARY_COLOR, $type="Enterprise")
62+
UpdateBoundaryStyle("system", $bgColor=$SYSTEM_BOUNDARY_BG_COLOR, $fontColor=$SYSTEM_BOUNDARY_COLOR, $borderColor=$SYSTEM_BOUNDARY_COLOR, $type="$SYSTEM_BOUNDARY_TYPE", $legendText="$SYSTEM_BOUNDARY_LEGEND_TEXT")
63+
UpdateBoundaryStyle("enterprise", $bgColor=$ENTERPRISE_BOUNDARY_BG_COLOR, $fontColor=$ENTERPRISE_BOUNDARY_COLOR, $borderColor=$ENTERPRISE_BOUNDARY_COLOR, $type="$ENTERPRISE_BOUNDARY_TYPE", $legendText="$ENTERPRISE_BOUNDARY_LEGEND_TEXT")
5064

5165
' shortcuts with default colors
5266
!unquoted procedure AddPersonTag($tagStereo, $bgColor="", $fontColor="", $borderColor="", $shadowing="", $shape="", $sprite="", $legendText="", $legendSprite="", $type="", $borderStyle="", $borderThickness="")

C4_Deployment.puml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
!$NODE_BG_COLOR ?= "#FFFFFF"
1313
!$NODE_BORDER_COLOR ?= "#A2A2A2"
1414

15+
' Labels
16+
' ##################################
17+
18+
!$NODE_LEGEND_TEXT ?= "node"
19+
1520
' Styling
1621
' ##################################
1722

@@ -22,7 +27,7 @@
2227
!$NODE_TYPE_MAX_CHAR_WIDTH ?= 35
2328
!$NODE_DESCR_MAX_CHAR_WIDTH ?= 32
2429

25-
UpdateElementStyle("node", $bgColor=$NODE_BG_COLOR, $fontColor=$NODE_FONT_COLOR, $borderColor=$NODE_BORDER_COLOR)
30+
UpdateElementStyle("node", $bgColor=$NODE_BG_COLOR, $fontColor=$NODE_FONT_COLOR, $borderColor=$NODE_BORDER_COLOR, $legendText="$NODE_LEGEND_TEXT")
2631
skinparam rectangle<<node>> {
2732
FontStyle normal
2833
}

C4_Sequence.puml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@
3434
!$LEGEND_DASHED_TRANSPARENT_BOUNDARY = ""
3535
!endif
3636
UpdateBoundaryStyle("", $bgColor=$BOUNDARY_BG_COLOR, $fontColor=$BOUNDARY_COLOR, $borderColor=$BOUNDARY_COLOR)
37-
UpdateBoundaryStyle("enterprise", $bgColor=$ENTERPRISE_BOUNDARY_BG_COLOR, $fontColor=$ENTERPRISE_BOUNDARY_COLOR, $borderColor=$ENTERPRISE_BOUNDARY_COLOR, $type="Enterprise")
38-
UpdateBoundaryStyle("system", $bgColor=$SYSTEM_BOUNDARY_BG_COLOR, $fontColor=$SYSTEM_BOUNDARY_COLOR, $borderColor=$SYSTEM_BOUNDARY_COLOR, $type="System")
39-
UpdateBoundaryStyle("container", $bgColor=$CONTAINER_BOUNDARY_BG_COLOR, $fontColor=$CONTAINER_BOUNDARY_COLOR, $borderColor=$CONTAINER_BOUNDARY_COLOR, $type="Container")
37+
UpdateBoundaryStyle("enterprise", $bgColor=$ENTERPRISE_BOUNDARY_BG_COLOR, $fontColor=$ENTERPRISE_BOUNDARY_COLOR, $borderColor=$ENTERPRISE_BOUNDARY_COLOR, $type="$ENTERPRISE_BOUNDARY_TYPE")
38+
UpdateBoundaryStyle("system", $bgColor=$SYSTEM_BOUNDARY_BG_COLOR, $fontColor=$SYSTEM_BOUNDARY_COLOR, $borderColor=$SYSTEM_BOUNDARY_COLOR, $type="$SYSTEM_BOUNDARY_TYPE")
39+
UpdateBoundaryStyle("container", $bgColor=$CONTAINER_BOUNDARY_BG_COLOR, $fontColor=$CONTAINER_BOUNDARY_COLOR, $borderColor=$CONTAINER_BOUNDARY_COLOR, $type="$CONTAINER_BOUNDARY_TYPE")
4040

4141
' Styling and Layout
4242
' ##################################

LayoutOptions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ C4-PlantUML comes with some layout options.
2424
- [SHOW_INDEX(?show)](#show_indexshow)
2525
- [Optional support of additional PlantUML elements](#optional-support-of-additional-plantuml-elements)
2626
- [List of supported PlantUML elements](#list-of-supported-plantuml-elements)
27-
- [📄 Themes](Themes.md#themes)
27+
- [📄 Themes (different styles and languages)](Themes.md#themes)
2828
- samples
2929
- [📄 C4 Model Diagrams](samples/C4CoreDiagrams.md#c4-model-diagrams)
3030

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ C4-PlantUML includes macros, stereotypes, and other goodies (like VSCode Snippet
6262
- [Background](#background)
6363
- [License](#license)
6464
- [📄 Layout Options](LayoutOptions.md#layout-options)
65-
- [📄 Themes](Themes.md#themes)
65+
- [📄 Themes (different styles and languages)](Themes.md#themes)
6666
- samples
6767
- [📄 C4 Model Diagrams](samples/C4CoreDiagrams.md#c4-model-diagrams)
6868

@@ -654,6 +654,13 @@ Like the element specific tag definitions exist boundary specific calls with the
654654
- `UpdateSystemBoundaryStyle(?bgColor, ?fontColor, ?borderColor, ?shadowing, ?shape, ?type, ?legendText, ?borderStyle, ?borderThickness, ?sprite, ?legendSprite)`
655655
- `UpdateEnterpriseBoundaryStyle(?bgColor, ?fontColor, ?borderColor, ?shadowing, ?shape, ?type, ?legendText, ?borderStyle, ?borderThickness, ?sprite, ?legendSprite)`
656656

657+
### Define a new legend title
658+
659+
All the above described `Update....(..., ?legendText, ...)` calls can define a new legend text.
660+
Only the legend title cannot be changed. Therefore, the following call is added to allow it to be changed as well:
661+
662+
- `UpdateLegendTitle(newTitle)`
663+
657664
### Comments
658665

659666
- `SHOW_LEGEND()` supports the customized stereotypes

0 commit comments

Comments
 (0)