From aee18ca018cd1c863de802db18308a53b8d29d5e Mon Sep 17 00:00:00 2001 From: Alois Klink Date: Thu, 13 Apr 2023 07:25:18 +0100 Subject: [PATCH] fix: fix `scaleLabelColor` in theme forest/neutral The `scaleLabelColor` variable in `theme-forest` and `theme-neutral` was set to `"calculated"`, as it defaults to `this.labelTextColor` **before** `this.labelTextColor` was set. Moving the `this.labelTextColor` assignments before `scaleLabelColor` is calculated fixes this. Fixes mindmap and timeline invalid CSS in theme forest and neutral. --- packages/mermaid/src/themes/theme-forest.js | 19 ++++++------ packages/mermaid/src/themes/theme-neutral.js | 32 ++++++++++---------- 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/packages/mermaid/src/themes/theme-forest.js b/packages/mermaid/src/themes/theme-forest.js index 67fc557a9..c6eb9574c 100644 --- a/packages/mermaid/src/themes/theme-forest.js +++ b/packages/mermaid/src/themes/theme-forest.js @@ -93,6 +93,15 @@ class Theme { this.errorTextColor = '#552222'; } updateColors() { + /* Sequence Diagram variables */ + this.actorBorder = darken(this.mainBkg, 20); + this.actorBkg = this.mainBkg; + this.labelBoxBkgColor = this.actorBkg; + this.labelTextColor = this.actorTextColor; + this.loopTextColor = this.actorTextColor; + this.noteBorderColor = this.border2; + this.noteTextColor = this.actorTextColor; + /* Each color-set will have a background, a foreground and a border color */ this.cScale0 = this.cScale0 || this.primaryColor; this.cScale1 = this.cScale1 || this.secondaryColor; @@ -144,16 +153,6 @@ class Theme { this.clusterBorder = this.border2; this.defaultLinkColor = this.lineColor; - /* Sequence Diagram variables */ - - this.actorBorder = darken(this.mainBkg, 20); - this.actorBkg = this.mainBkg; - this.labelBoxBkgColor = this.actorBkg; - this.labelTextColor = this.actorTextColor; - this.loopTextColor = this.actorTextColor; - this.noteBorderColor = this.border2; - this.noteTextColor = this.actorTextColor; - /* Gantt chart variables */ this.taskBorderColor = this.border1; diff --git a/packages/mermaid/src/themes/theme-neutral.js b/packages/mermaid/src/themes/theme-neutral.js index 15c3d1d2d..d03d7be1d 100644 --- a/packages/mermaid/src/themes/theme-neutral.js +++ b/packages/mermaid/src/themes/theme-neutral.js @@ -108,6 +108,22 @@ class Theme { this.secondBkg = lighten(this.contrast, 55); this.border2 = this.contrast; + /* Sequence Diagram variables */ + + this.actorBorder = lighten(this.border1, 23); + this.actorBkg = this.mainBkg; + this.actorTextColor = this.text; + this.actorLineColor = this.lineColor; + this.signalColor = this.text; + this.signalTextColor = this.text; + this.labelBoxBkgColor = this.actorBkg; + this.labelBoxBorderColor = this.actorBorder; + this.labelTextColor = this.text; + this.loopTextColor = this.text; + this.noteBorderColor = '#999'; + this.noteBkgColor = '#666'; + this.noteTextColor = '#fff'; + /* Color Scale */ /* Each color-set will have a background, a foreground and a border color */ @@ -161,22 +177,6 @@ class Theme { this.defaultLinkColor = this.lineColor; this.titleColor = this.text; - /* Sequence Diagram variables */ - - this.actorBorder = lighten(this.border1, 23); - this.actorBkg = this.mainBkg; - this.actorTextColor = this.text; - this.actorLineColor = this.lineColor; - this.signalColor = this.text; - this.signalTextColor = this.text; - this.labelBoxBkgColor = this.actorBkg; - this.labelBoxBorderColor = this.actorBorder; - this.labelTextColor = this.text; - this.loopTextColor = this.text; - this.noteBorderColor = '#999'; - this.noteBkgColor = '#666'; - this.noteTextColor = '#fff'; - /* Gantt chart variables */ this.sectionBkgColor = lighten(this.contrast, 30);