1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
//! Shared styling types and constants for diagram renderers.
//!
//! This module centralises CSS colour values, stroke specifications, and
//! font-size constants that are used by multiple diagram renderers. Nothing
//! in this module is wired into the renderers yet; that migration will happen
//! in a later phase. The `dead_code` lint is suppressed at the module level
//! because every item here will be used once individual renderers migrate.
// ─────────────────────────────────────────────────────────────────────────────
// Color type
// ─────────────────────────────────────────────────────────────────────────────
/// A CSS colour value (hex, hsl, named, etc.).
;
// ─────────────────────────────────────────────────────────────────────────────
// Stroke type
// ─────────────────────────────────────────────────────────────────────────────
/// A stroke specification (colour + width).
// ─────────────────────────────────────────────────────────────────────────────
// Universal / utility colours
// ─────────────────────────────────────────────────────────────────────────────
/// Fully transparent. Used where SVG `fill="none"` or CSS `transparent` is needed.
pub const TRANSPARENT: Color = Color;
/// Pure white — `#ffffff`. Background of many diagram elements and edge labels.
pub const WHITE: Color = Color;
/// Pure black — `#000000`. Used for terminal strokes, sequence crosshead markers, etc.
pub const BLACK: Color = Color;
// ─────────────────────────────────────────────────────────────────────────────
// Mermaid default-theme primary palette
// ─────────────────────────────────────────────────────────────────────────────
/// Primary node fill — `#ECECFF`.
///
/// Used by: requirement boxes, entity boxes, block cylinders, pie slice 1,
/// quadrant-1 fill, git tag background, block nodes, flowchart nodes.
pub const PRIMARY_COLOR: Color = Color;
/// Primary node border / stroke — `#9370DB` (medium purple).
///
/// Used by: requirement boxes, entity boxes, block cylinders, flowchart node
/// strokes, neo-look node strokes.
pub const PRIMARY_BORDER: Color = Color;
/// Secondary colour — `#ffffde` (pale yellow).
///
/// Used by: cluster backgrounds, commit-label backgrounds, pie slice 2,
/// note-related cluster fills (some contexts).
pub const SECONDARY_COLOR: Color = Color;
/// Secondary border — `#aaaa33` (dark yellow-green).
///
/// Used by: cluster borders, note strokes.
pub const SECONDARY_BORDER: Color = Color;
/// Tertiary colour — `#fff0f0` (very light pink). Default theme tertiary fill.
pub const TERTIARY_COLOR: Color = Color;
/// Tertiary border — `#ff0000` (red). Default theme tertiary stroke.
pub const TERTIARY_BORDER: Color = Color;
// ─────────────────────────────────────────────────────────────────────────────
// Common line / text colours
// ─────────────────────────────────────────────────────────────────────────────
/// Standard connector / edge line colour — `#333333`.
///
/// Used by: flowchart edges, arrowheads, markers, ER relationship lines,
/// requirement edges, architecture edges, block edges.
pub const LINE_COLOR: Color = Color;
/// Standard font / text colour — `#333333`.
///
/// Used by: label text, cluster label text, title text, flowchart labels,
/// block labels, architecture node labels, requirement text.
pub const FONT_COLOR: Color = Color;
/// Abbreviated dark text — `#333` (identical to `#333333` in CSS).
///
/// Some renderers use the 3-digit shorthand; this constant captures it exactly.
pub const FONT_COLOR_SHORT: Color = Color;
/// Near-black text used in quadrant and xy-chart renderers — `#131300`.
///
/// Used by: quadrant label fills, xy-chart axis/title colours,
/// class-diagram edge-label text.
pub const DARK_TEXT: Color = Color;
// ─────────────────────────────────────────────────────────────────────────────
// Note colours
// ─────────────────────────────────────────────────────────────────────────────
/// Note box fill — `#fff5ad` (pale yellow).
///
/// Used by: sequence diagram notes, state diagram notes/annotations.
pub const NOTE_FILL: Color = Color;
/// Note box stroke — `#aaaa33` (same as `SECONDARY_BORDER`).
///
/// Used by: sequence diagram notes, state diagram notes/annotations.
pub const NOTE_STROKE: Color = Color;
// ─────────────────────────────────────────────────────────────────────────────
// Error / diagnostic colours
// ─────────────────────────────────────────────────────────────────────────────
/// Error icon / text fill — `#552222` (dark red).
///
/// Used by: flowchart and block `.error-icon` and `.error-text` CSS rules.
pub const ERROR_COLOR: Color = Color;
// ─────────────────────────────────────────────────────────────────────────────
// Edge-label background
// ─────────────────────────────────────────────────────────────────────────────
/// Edge-label rectangle background — semi-transparent light grey.
///
/// Used as `fill` in flowchart / block edge-label `<rect>` elements:
/// `rgba(232,232,232, 0.8)`.
pub const EDGE_LABEL_BG: Color = Color;
// ─────────────────────────────────────────────────────────────────────────────
// C4 diagram colours
// ─────────────────────────────────────────────────────────────────────────────
/// C4 Person element fill — `#08427B` (dark navy blue).
pub const C4_PERSON_FILL: Color = Color;
/// C4 Person element stroke — `#073B6F`.
pub const C4_PERSON_STROKE: Color = Color;
/// C4 external element fill — `#999999` (medium grey).
pub const C4_EXT_FILL: Color = Color;
/// C4 external element stroke — `#8A8A8A`.
pub const C4_EXT_STROKE: Color = Color;
/// C4 internal (system/container/component) element fill — `#1168BD` (medium blue).
pub const C4_INTERNAL_FILL: Color = Color;
/// C4 internal element stroke — `#3C7FC0`.
pub const C4_INTERNAL_STROKE: Color = Color;
/// C4 boundary stroke and dark text colour — `#444444`.
pub const C4_BOUNDARY_STROKE: Color = Color;
/// White text used on dark C4 element backgrounds — `#FFFFFF`.
pub const C4_LIGHT_TEXT: Color = Color;
// ─────────────────────────────────────────────────────────────────────────────
// Railroad diagram colours
// ─────────────────────────────────────────────────────────────────────────────
/// Railroad terminal node fill — `#FFFFC0` (pale yellow).
pub const RAILROAD_TERMINAL_FILL: Color = Color;
/// Railroad non-terminal node fill — `#FFFFFF` (white).
pub const RAILROAD_NONTERMINAL_FILL: Color = Color;
/// Railroad rule-name label colour — `#000066` (dark blue).
pub const RAILROAD_RULE_NAME_COLOR: Color = Color;
/// Railroad special node fill — `#F0E0FF` (pale lavender).
pub const RAILROAD_SPECIAL_FILL: Color = Color;
/// Railroad special node stroke — `#8800CC` (purple).
pub const RAILROAD_SPECIAL_STROKE: Color = Color;
// ─────────────────────────────────────────────────────────────────────────────
// Architecture diagram colours
// ─────────────────────────────────────────────────────────────────────────────
/// Architecture service-icon background fill — `#087ebf` (blue).
pub const ARCH_ICON_FILL: Color = Color;
/// Architecture node-group border — `hsl(240, 60%, 86.2745098039%)`.
pub const ARCH_GROUP_STROKE: Color = Color;
// ─────────────────────────────────────────────────────────────────────────────
// Wardley map colours
// ─────────────────────────────────────────────────────────────────────────────
/// Wardley even-stage background fill — `#f9f9fb` (near white).
pub const WARDLEY_STAGE_EVEN: Color = Color;
/// Wardley odd-stage background fill — `#f0f0f5` (very light lavender).
pub const WARDLEY_STAGE_ODD: Color = Color;
// ─────────────────────────────────────────────────────────────────────────────
// Cynefin diagram colours
// ─────────────────────────────────────────────────────────────────────────────
/// Cynefin Complex quadrant background — `#e8f4f8`.
pub const CYNEFIN_COMPLEX_BG: Color = Color;
/// Cynefin Complicated quadrant background — `#f0ffe0`.
pub const CYNEFIN_COMPLICATED_BG: Color = Color;
/// Cynefin Chaotic quadrant background — `#fff0f0`.
pub const CYNEFIN_CHAOTIC_BG: Color = Color;
/// Cynefin Clear quadrant background — `#fffff0`.
pub const CYNEFIN_CLEAR_BG: Color = Color;
/// Cynefin Confusion ellipse background — `#f5f5f5`.
pub const CYNEFIN_CONFUSION_BG: Color = Color;
// ─────────────────────────────────────────────────────────────────────────────
// Mindmap root colour
// ─────────────────────────────────────────────────────────────────────────────
/// Mindmap root node fill — `hsl(240, 100%, 46.2745098039%)` (deep blue).
pub const MINDMAP_ROOT_FILL: Color = Color;
/// Mindmap root node text colour — `#ffffff`.
pub const MINDMAP_ROOT_TEXT: Color = Color;
// ─────────────────────────────────────────────────────────────────────────────
// Common stroke-width constants (px)
// ─────────────────────────────────────────────────────────────────────────────
/// Thin stroke used for node borders in most diagrams (px).
pub const STROKE_WIDTH_THIN: f64 = 1.0;
/// Standard stroke width for railroad shapes and outer pie border (px).
pub const STROKE_WIDTH_STANDARD: f64 = 2.0;
/// Thick stroke used for architecture edges (px).
pub const STROKE_WIDTH_THICK: f64 = 3.0;
// ─────────────────────────────────────────────────────────────────────────────
// Pre-built Stroke values for frequently repeated combinations
// ─────────────────────────────────────────────────────────────────────────────
/// The default primary node stroke: `#9370DB` at 1 px.
pub const PRIMARY_NODE_STROKE: Stroke = new;
/// The default line / edge stroke: `#333333` at 1 px.
pub const EDGE_STROKE: Stroke = new;
/// The standard railroad stroke: `#000000` at 2 px.
pub const RAILROAD_STROKE: Stroke = new;
// ─────────────────────────────────────────────────────────────────────────────
// Common font-size constants (px)
// ─────────────────────────────────────────────────────────────────────────────
/// Standard body font size used across most diagram renderers (px).
pub const FONT_SIZE_DEFAULT: f64 = 16.0;
/// Smaller font size used by gantt, railroad, journey, zenuml, cynefin, ishikawa (px).
pub const FONT_SIZE_SMALL: f64 = 14.0;
/// Compact font size used by gantt axis labels (px).
pub const FONT_SIZE_TINY: f64 = 10.0;