Skip to content

Commit ea53021

Browse files
committed
Add dark and light mode support.
- updated color definitions in doubleslash-gen2.puml. - Introduced new theme files for dark and light modes, allowing easy selection for static-site-generators like mkdocs.
1 parent 1186ebb commit ea53021

File tree

3 files changed

+82
-24
lines changed

3 files changed

+82
-24
lines changed

doubleslash/dark.puml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@startuml
2+
!$PUML_MODE = "dark"
3+
!$PUML_BGCOLOR = "#1E1E1E"
4+
!$PUML_GRADIENT = 15
5+
!include doubleslash/doubleslash-gen2.puml
6+
@enduml

doubleslash/doubleslash-gen2.puml

Lines changed: 70 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ skinparam useBetaStyle false
4646

4747
!$FONTNAME = "Helvetica"
4848
''
49-
'' DoubleSlash Corporate Colors
49+
'' DoubleSlash Corporate Colors (Base - will be adjusted for dark mode)
5050
''
5151
!$DS_BLUE = "#00A5E1"
5252
!$DS_LIGHTBLUE = "#D7E9F4"
@@ -71,12 +71,25 @@ skinparam useBetaStyle false
7171
!$LIGHT = $DS_LIGHTGREY
7272
!$DARK = $DS_DARKGREY
7373
!$BLACK = "#000"
74+
75+
''
76+
'' Dark mode specific colors (will be used when PUML_MODE = "dark")
77+
''
78+
!$DARK_BG = "#1E1E1E"
79+
!$DARK_SURFACE = "#2D2D2D"
80+
!$DARK_CARD = "#3A3A3A"
81+
!$DARK_HOVER = "#4A4A4A"
82+
!$DARK_BORDER = "#5A5A5A"
83+
!$DARK_TEXT = "#FFFFFF"
84+
!$DARK_TEXT_SECONDARY = "#B6B6B6"
85+
!$DARK_TEXT_DISABLED = "#7A7A7A"
86+
7487
''
7588
'' define colors based on PUML_MODE
7689
''
7790
!if ($PUML_MODE == "light")
91+
'' Light mode - use original doubleSlash colors
7892
!$SECONDARY = $DS_LIGHTBLUE
79-
'' hardcode $SECONDARY_LIGHT since it is so close to white
8093
!$SECONDARY_LIGHT = $SUPERLIGHTGREY
8194
!$SUCCESS = $LIGHTGREEN
8295
!$INFO = $DS_BLUE
@@ -90,14 +103,36 @@ skinparam useBetaStyle false
90103
''
91104
!assume transparent light
92105
!else
93-
!$SECONDARY = $STEELBLUE25
94-
!$SECONDARY_LIGHT = %lighten($SECONDARY, $PUML_GRADIENT)
95-
!$SUCCESS = $LIGHTGREEN
96-
!$INFO = $DS_LIGHTBLUE
106+
'' Dark mode - adjust colors for dark background
107+
'' Adjust primary doubleSlash colors for better dark mode contrast
108+
!$DS_BLUE = "#4FA8E1"
109+
!$DS_LIGHTBLUE = "#2A5B7A"
110+
!$DS_DARKGREY = "#CCCCCC"
111+
!$DS_LIGHTGREY = "#B6B6B6"
112+
!$PRIMARY = $DS_BLUE
113+
!$LIGHT = $DS_LIGHTGREY
114+
!$DARK = $DS_DARKGREY
115+
116+
'' Dark mode color assignments
117+
!$SECONDARY = $DS_LIGHTBLUE
118+
!$SECONDARY_LIGHT = $DARK_SURFACE
119+
!$SUCCESS = "#90D478"
120+
!$INFO = $DS_BLUE
97121
!$DANGER = "#ff5d64"
98-
!$SECONDARY_TEXT = $WHITE
99-
!$FGCOLOR = $WHITE
122+
!$SECONDARY_TEXT = $DARK_TEXT
123+
!$FGCOLOR = $DARK_TEXT
100124
!$DIAMOND_BD = %lighten($SECONDARY, $PUML_GRADIENT)
125+
126+
'' Update additional colors for dark mode
127+
!$SUPERLIGHTGREY = $DARK_SURFACE
128+
!$ALICEBLUE = $DARK_CARD
129+
!$WHITE = $DARK_TEXT
130+
!$BLACK = $DARK_TEXT
131+
132+
'' Set dark background if not explicitly set
133+
!if %not(%variable_exists("$PUML_BGCOLOR")) || ($PUML_BGCOLOR == "white")
134+
!$PUML_BGCOLOR = $DARK_BG
135+
!endif
101136
''
102137
'' Assume if the background is transparent, that the
103138
'' background will be dark for this theme
@@ -207,13 +242,13 @@ skinparam stereotype {
207242
skinparam title {
208243
FontSize 28
209244
BorderRoundCorner 16
210-
FontColor $DS_DARKGREY
245+
FontColor $FGCOLOR
211246
FontName $FONTNAME
212247
FontStyle normal
213248
}
214249

215250
skinparam legend {
216-
FontColor $DS_DARKGREY
251+
FontColor $FGCOLOR
217252
BorderColor $DS_GREY
218253
BackgroundColor transparent
219254
}
@@ -277,7 +312,7 @@ skinparam sequence {
277312
ArrowFontSize 11
278313
BorderColor $DS_BLUE
279314
' For some reason sequence title font color does not pick up from global
280-
TitleFontColor $DS_DARKGREY
315+
TitleFontColor $FGCOLOR
281316
BackgroundColor $PUML_BGCOLOR
282317
StartColor $DS_BLUE
283318
EndColor $DS_BLUE
@@ -321,7 +356,7 @@ skinparam sequence {
321356
ReferenceHeaderFontColor $DS_BLUE
322357
ReferenceHeaderBackgroundColor $DS_LIGHTGREY
323358
''
324-
StereotypeFontColor $DS_DARKGREY
359+
StereotypeFontColor $FGCOLOR
325360
StereotypeFontSize 12
326361
}
327362
!endsub
@@ -372,7 +407,7 @@ skinparam agent {
372407
FontColor $BLACK
373408
BorderThickness 0
374409
BackgroundColor<<external>> $SUPERLIGHTGREY
375-
FontColor<<external>> black
410+
FontColor<<external>> $BLACK
376411
BorderThickness<<external>> 0
377412
}
378413
!endsub
@@ -382,7 +417,7 @@ skinparam note {
382417
BorderThickness 0.0
383418
BackgroundColor transparent
384419
BorderColor transparent
385-
FontColor $DS_DARKGREY
420+
FontColor $FGCOLOR
386421
FontSize 11
387422
TextAlignment left
388423
}
@@ -462,7 +497,7 @@ skinparam class {
462497
FontSize 15
463498
Fontstyle bold
464499
HeaderBackgroundColor $DS_LIGHTBLUE
465-
StereotypeFontColor $DS_DARKGREY
500+
StereotypeFontColor $FGCOLOR
466501
AttributeFontColor $BLACK
467502
AttributeFontName $FONTNAME
468503
AttributeFontSize 12
@@ -478,7 +513,7 @@ skinparam object {
478513
BorderColor $DS_BLUE
479514
BorderThickness 0
480515
FontColor $BLACK
481-
StereotypeFontColor $DS_DARKGREY
516+
StereotypeFontColor $FGCOLOR
482517
AttributeFontColor $BLACK
483518
AttributeFontSize 11
484519
}
@@ -489,7 +524,7 @@ skinparam usecase {
489524
BackgroundColor $DS_LIGHTBLUE
490525
BorderThickness 0.0
491526
FontName $FONTNAME
492-
FontColor $DS_DARKGREY
527+
FontColor $FGCOLOR
493528
StereotypeFontColor $DS_BLUE
494529
BackgroundColor<<External>> $SUPERLIGHTGREY
495530
}
@@ -555,7 +590,7 @@ skinparam card {
555590
BackgroundColor $DS_LIGHTBLUE
556591
BorderColor $DS_BLUE
557592
BorderThickness 0.4
558-
FontColor $DS_DARKGREY
593+
FontColor $FGCOLOR
559594
BackgroundColor<<external>> $SUPERLIGHTGREY
560595
BorderColor<<external>> $DS_GREY
561596
}
@@ -565,7 +600,7 @@ skinparam card {
565600
skinparam file {
566601
BackgroundColor $SUPERLIGHTGREY
567602
BorderColor $DS_GREY
568-
FontColor $DS_DARKGREY
603+
FontColor $FGCOLOR
569604
}
570605
!endsub
571606

@@ -589,11 +624,20 @@ skinparam map {
589624
''
590625
'' C4+M Level Styling (System Architecture)
591626
''
592-
!define CONTEXT_BG #FFFFFF
593-
!define CONTAINER_BG #EEF8FE
594-
!define COMPONENT_BG #D7E9F4
595-
!define MODULE_BG #AFC1C7
596-
!define CODE_BG #84999F
627+
!if ($PUML_MODE == "light")
628+
!define CONTEXT_BG #FFFFFF
629+
!define CONTAINER_BG #EEF8FE
630+
!define COMPONENT_BG #D7E9F4
631+
!define MODULE_BG #AFC1C7
632+
!define CODE_BG #84999F
633+
!else
634+
'' Dark mode C4 colors
635+
!define CONTEXT_BG #2A2A2A
636+
!define CONTAINER_BG #353535
637+
!define COMPONENT_BG #404040
638+
!define MODULE_BG #4A4A4A
639+
!define CODE_BG #555555
640+
!endif
597641

598642
' Context Level
599643
skinparam RectangleBackgroundColor<<context>> CONTEXT_BG
@@ -635,6 +679,8 @@ skinparam ComponentStyle rectangle
635679
'' When mixing skinparam and <style>, it is very important to put <style> after skinparam
636680
''
637681
'' Style settings.
682+
'' Note: Style sections cannot reference variables, so dark mode colors are hardcoded.
683+
'' For comprehensive dark mode support, consider using separate theme files or skinparam only.
638684
''
639685
<style>
640686
mindmapDiagram {

doubleslash/light.puml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@startuml
2+
!$PUML_MODE = "light"
3+
!$PUML_BGCOLOR = "white"
4+
!$PUML_GRADIENT = 20
5+
!include doubleslash/doubleslash-gen2.puml
6+
@enduml

0 commit comments

Comments
 (0)