From 4838d6345593e09fb227839675caebde86dba8b4 Mon Sep 17 00:00:00 2001 From: Knut Sveidqvist Date: Wed, 19 Oct 2022 14:37:48 +0200 Subject: [PATCH] Theme update from release 9.2 --- packages/mermaid-mindmap/src/styles.js | 4 +--- packages/mermaid/src/themes/theme-default.js | 15 +++++++++++---- packages/mermaid/src/themes/theme-forest.js | 5 ++++- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/packages/mermaid-mindmap/src/styles.js b/packages/mermaid-mindmap/src/styles.js index 95674e8f8..a409aa4e5 100644 --- a/packages/mermaid-mindmap/src/styles.js +++ b/packages/mermaid-mindmap/src/styles.js @@ -22,12 +22,10 @@ const genSections = (options) => { } .section-${i - 1} text { fill: ${options['cScaleLabel' + i]}; - // fill: ${options['gitInv' + i]}; } .node-icon-${i - 1} { font-size: 40px; color: ${options['cScaleLabel' + i]}; - // color: ${options['gitInv' + i]}; } .section-edge-${i - 1}{ stroke: ${options['cScale' + i]}; @@ -36,7 +34,7 @@ const genSections = (options) => { stroke-width: ${sw}; } .section-${i - 1} line { - stroke: ${options['lineColor' + i]} ; + stroke: ${options['cScaleInv' + i]} ; stroke-width: 3; } diff --git a/packages/mermaid/src/themes/theme-default.js b/packages/mermaid/src/themes/theme-default.js index 1cd2f505c..95710629b 100644 --- a/packages/mermaid/src/themes/theme-default.js +++ b/packages/mermaid/src/themes/theme-default.js @@ -147,11 +147,18 @@ class Theme { this['cScaleInv' + i] = this['cScaleInv' + i] || adjust(this['cScale' + i], { h: 180 }); } - // Setup teh label color for the set - this.scaleLabelColor = this.scaleLabelColor || (this.darkMode ? 'black' : this.labelTextColor); + // Setup the label color for the set + this.scaleLabelColor = + this.scaleLabelColor !== 'calculated' && this.scaleLabelColor + ? this.scaleLabelColor + : this.labelTextColor; - for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) { - this['cScaleLabel' + i] = this['cScaleLabel' + i] || this.scaleLabelColor; + if (this.labelTextColor !== 'calculated') { + this.cScaleLabel0 = this.cScaleLabel0 || invert(this.labelTextColor); + this.cScaleLabel3 = this.cScaleLabel3 || invert(this.labelTextColor); + for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) { + this['cScaleLabel' + i] = this['cScaleLabel' + i] || this.labelTextColor; + } } /* Flowchart variables */ diff --git a/packages/mermaid/src/themes/theme-forest.js b/packages/mermaid/src/themes/theme-forest.js index bacdd5bd0..860326dea 100644 --- a/packages/mermaid/src/themes/theme-forest.js +++ b/packages/mermaid/src/themes/theme-forest.js @@ -121,7 +121,10 @@ class Theme { } // Setup teh label color for the set - this.scaleLabelColor = this.scaleLabelColor || (this.darkMode ? 'black' : this.labelTextColor); + this.scaleLabelColor = + this.scaleLabelColor !== 'calculated' && this.scaleLabelColor + ? this.scaleLabelColor + : this.labelTextColor; for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) { this['cScaleLabel' + i] = this['cScaleLabel' + i] || this.scaleLabelColor;