|
275 | 275 | const darkQuery = window.matchMedia("(prefers-color-scheme: dark)"); |
276 | 276 |
|
277 | 277 | // Dark scheme: a retro terminal on black. Bright phosphor strokes (green, cyan, amber, magenta) on near-black |
278 | | - // fills, not pastels. In the light scheme Mermaid's "neutral" theme is used. |
| 278 | + // fills, not pastels. The light scheme has its own, muted palette (LIGHT_THEME). |
279 | 279 | const DARK_THEME = { |
280 | 280 | darkMode: true, |
281 | 281 | background: "#000000", |
|
331 | 331 | cScaleLabel0: "#000000", cScaleLabel1: "#000000", cScaleLabel2: "#000000", cScaleLabel3: "#000000", |
332 | 332 | cScaleLabel4: "#000000", cScaleLabel5: "#000000", cScaleLabel6: "#ffffff", cScaleLabel7: "#000000", |
333 | 333 | }; |
| 334 | + // Light scheme: colour, but muted. Tinted fills with a darker border of the same hue, so nothing is white or |
| 335 | + // shouting; "neutral" left the nodes almost white. |
| 336 | + const LIGHT_THEME = { |
| 337 | + darkMode: false, |
| 338 | + background: "#ffffff", |
| 339 | + fontSize: "15px", |
| 340 | + primaryColor: "#d3e1f0", |
| 341 | + primaryTextColor: "#1f2f44", |
| 342 | + primaryBorderColor: "#5a7fa8", |
| 343 | + secondaryColor: "#d6e8d8", |
| 344 | + secondaryTextColor: "#1f3a24", |
| 345 | + secondaryBorderColor: "#5d8f63", |
| 346 | + tertiaryColor: "#efe2c8", |
| 347 | + tertiaryTextColor: "#4a3511", |
| 348 | + tertiaryBorderColor: "#a8803a", |
| 349 | + mainBkg: "#d3e1f0", |
| 350 | + nodeBorder: "#5a7fa8", |
| 351 | + nodeTextColor: "#1f2f44", |
| 352 | + clusterBkg: "#f1ebdd", |
| 353 | + clusterBorder: "#b0894a", |
| 354 | + titleColor: "#7a5a1e", |
| 355 | + lineColor: "#4b5b70", |
| 356 | + textColor: "#1f2937", |
| 357 | + edgeLabelBackground: "#ffffff", |
| 358 | + actorBkg: "#d3e1f0", |
| 359 | + actorBorder: "#5a7fa8", |
| 360 | + actorTextColor: "#1f2f44", |
| 361 | + actorLineColor: "#9aa8b8", |
| 362 | + signalColor: "#3f7d6e", |
| 363 | + signalTextColor: "#1f2937", |
| 364 | + labelBoxBkgColor: "#efe2c8", |
| 365 | + labelBoxBorderColor: "#a8803a", |
| 366 | + labelTextColor: "#4a3511", |
| 367 | + loopTextColor: "#7a5a1e", |
| 368 | + noteBkgColor: "#f0d5df", |
| 369 | + noteBorderColor: "#b05c7c", |
| 370 | + noteTextColor: "#4a1f33", |
| 371 | + activationBkgColor: "#cfe3d0", |
| 372 | + activationBorderColor: "#5d8f63", |
| 373 | + sequenceNumberColor: "#ffffff", |
| 374 | + labelColor: "#1f2f44", |
| 375 | + altBackground: "#f3f1ea", |
| 376 | + pie1: "#5a7fa8", pie2: "#6aa070", pie3: "#c9a24f", pie4: "#b0698a", pie5: "#b86a64", pie6: "#5f9ea0", |
| 377 | + pie7: "#8aa24f", pie8: "#8a78b5", pie9: "#c9875a", pie10: "#5f9a90", pie11: "#a56fa8", pie12: "#b59a4a", |
| 378 | + pieTitleTextColor: "#1f2937", pieSectionTextColor: "#ffffff", pieLegendTextColor: "#1f2937", |
| 379 | + pieStrokeColor: "#ffffff", pieOuterStrokeColor: "#4b5b70", pieOpacity: "0.95", |
| 380 | + cScale0: "#5a7fa8", cScale1: "#6aa070", cScale2: "#c9a24f", cScale3: "#b0698a", |
| 381 | + cScale4: "#b86a64", cScale5: "#5f9ea0", cScale6: "#8a78b5", cScale7: "#8aa24f", |
| 382 | + cScaleLabel0: "#ffffff", cScaleLabel1: "#ffffff", cScaleLabel2: "#1f2937", cScaleLabel3: "#ffffff", |
| 383 | + cScaleLabel4: "#ffffff", cScaleLabel5: "#ffffff", cScaleLabel6: "#ffffff", cScaleLabel7: "#1f2937", |
| 384 | + }; |
| 385 | + |
334 | 386 | function configure(mermaid) { |
335 | 387 | const dark = darkQuery.matches; |
336 | 388 | mermaid.initialize({ |
337 | 389 | startOnLoad: false, |
338 | 390 | securityLevel: "strict", |
339 | 391 | suppressErrorRendering: true, |
340 | | - theme: dark ? "base" : "neutral", |
341 | | - themeVariables: dark ? DARK_THEME : {}, |
| 392 | + theme: "base", |
| 393 | + themeVariables: dark ? DARK_THEME : LIGHT_THEME, |
342 | 394 | fontFamily: '"Fira Code", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace', |
343 | 395 | // SVG text labels: HTML labels (foreignObject) are measured with the page's own CSS, which skews the layout. |
344 | 396 | htmlLabels: false, |
|
0 commit comments