Skip to content

Commit

Permalink
Merge pull request #4018 from mermaid-js/4016-differentiate-colors
Browse files Browse the repository at this point in the history
Mindmaps: differentiate the colors between the root node and the first section #4017
  • Loading branch information
pbrolin47 authored Jan 20, 2023
2 parents e573be4 + 023f235 commit 7b67f57
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 17 deletions.
36 changes: 23 additions & 13 deletions cypress/platform/knsv2.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,22 @@
</style>
</head>
<body>
<pre id="diagram" class="mermaid">
<pre id="diagram" class="mermaid2">
%%{init: {"flowchart": {"defaultRenderer": "elk"}} }%%
graph TB
a --> b
a --> c
b --> d
c --> d
</pre>
<pre id="diagram" class="mermaid">
<pre id="diagram" class="mermaid2">
flowchart-elk TB
a --> b
a --> c
b --> d
c --> d
</pre>
<pre id="diagram" class="mermaid">
<pre id="diagram" class="mermaid2">
%%{init: {"flowchart": {"defaultRenderer": "elk"}} }%%
flowchart TB
%% I could not figure out how to use double quotes in labels in Mermaid
Expand Down Expand Up @@ -125,7 +125,7 @@
</pre
>
<br />
<pre id="diagram" class="mermaid">
<pre id="diagram" class="mermaid2">
flowchart TB
%% I could not figure out how to use double quotes in labels in Mermaid
subgraph ibm[IBM Espresso CPU]
Expand Down Expand Up @@ -227,14 +227,24 @@
Customer->>+Merchant: Receives goods or services
</pre
>
<pre id="diagram" class="mermaid2">
gantt
title Style today marker (vertical line should be 5px wide and half-transparent blue)
dateFormat YYYY-MM-DD
axisFormat %d
todayMarker stroke-width:5px,stroke:#00f,opacity:0.5
section Section1
Today: 1, -1h
<pre id="diagram" class="mermaid">
mindmap
root((mindmap))
Origins
Long history
::icon(fa fa-book)
Popularisation
British popular psychology author Tony Buzan
Research
On effectiveness<br/>and features
On Automatic creation
Uses
Creative techniques
Strategic planning
Argument mapping
Tools
Pen and paper
Mermaid
</pre>

<!-- <div id="cy"></div> -->
Expand All @@ -252,7 +262,7 @@
// console.error('Mermaid error: ', err);
};
mermaid.initialize({
// theme: 'forest',
theme: 'dark',
startOnLoad: true,
logLevel: 0,
flowchart: {
Expand Down
6 changes: 2 additions & 4 deletions packages/mermaid-mindmap/src/svgDraw.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,12 @@ const roundedRectBkg = function (elem, node) {
* @returns {number} The height nodes dom element
*/
export const drawNode = function (elem, node, fullSection, conf) {
const section = (fullSection % MAX_SECTIONS) - 1;
const section = fullSection % MAX_SECTIONS;
const nodeElem = elem.append('g');
node.section = section;
nodeElem.attr(
'class',
(node.class ? node.class + ' ' : '') +
'mindmap-node ' +
(section < 0 ? 'section-root' : 'section-' + section)
(node.class ? node.class + ' ' : '') + 'mindmap-node ' + ('section-' + section)
);
const bkgElem = nodeElem.append('g');

Expand Down

0 comments on commit 7b67f57

Please sign in to comment.