mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-19 07:19:41 +02:00
This commit is contained in:
@@ -68,13 +68,36 @@ stateDiagram-v2
|
|||||||
Finished --> [*]
|
Finished --> [*]
|
||||||
</div>
|
</div>
|
||||||
<div class="mermaid" style="width: 100%; height: 20%;">
|
<div class="mermaid" style="width: 100%; height: 20%;">
|
||||||
stateDiagram-v2
|
%%{init:{
|
||||||
state "Long state name" as NotShooting {
|
"themeVariables": {
|
||||||
a-->b
|
"transitionColor":"red",
|
||||||
|
"labelColor":"yellow",
|
||||||
|
"transitionLabelColor":"blue",
|
||||||
|
"stateBkg":"green",
|
||||||
|
"compositeBackground":"pink",
|
||||||
|
"altBackground":"purple",
|
||||||
|
"clusterTitleBackground":"blue",
|
||||||
|
"compositeBorder":"red"
|
||||||
|
}}}%%
|
||||||
|
stateDiagram
|
||||||
|
state CompositeState {
|
||||||
|
state AnotherCompositeState {
|
||||||
|
AnotherState --> YetANotherState:a label
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="mermaid2" style="width: 100%; height: 20%;">
|
<div class="mermaid2" style="width: 100%; height: 20%;">
|
||||||
|
%%{init:{
|
||||||
|
"themeVariables": {
|
||||||
|
"transitionColor":"red",
|
||||||
|
"labelColor":"yellow",
|
||||||
|
"transitionLabelColor":"blue",
|
||||||
|
"stateBkg":"green",
|
||||||
|
"compositeBackground":"pink",
|
||||||
|
"altBackground":"purple",
|
||||||
|
"clusterTitleBackground":"blue"
|
||||||
|
}}}%%
|
||||||
stateDiagram-v2
|
stateDiagram-v2
|
||||||
[*] --> Off
|
[*] --> Off
|
||||||
Off --> On
|
Off --> On
|
||||||
@@ -214,7 +237,7 @@ style N stroke:#0000ff,fill:#ccccff,color:#0000ff
|
|||||||
// console.error('Mermaid error: ', err);
|
// console.error('Mermaid error: ', err);
|
||||||
};
|
};
|
||||||
mermaid.initialize({
|
mermaid.initialize({
|
||||||
theme: 'neutral',
|
theme: 'base',
|
||||||
arrowMarkerAbsolute: true,
|
arrowMarkerAbsolute: true,
|
||||||
// themeCSS: '.edgePath .path {stroke: red;} .arrowheadPath {fill: red;}',
|
// themeCSS: '.edgePath .path {stroke: red;} .arrowheadPath {fill: red;}',
|
||||||
logLevel: 0,
|
logLevel: 0,
|
||||||
|
@@ -1,5 +1,10 @@
|
|||||||
const getStyles = options =>
|
const getStyles = options =>
|
||||||
`g.stateGroup text {
|
`
|
||||||
|
defs #statediagram-barbEnd {
|
||||||
|
fill: ${options.transitionColor};
|
||||||
|
stroke: ${options.transitionColor};
|
||||||
|
}
|
||||||
|
g.stateGroup text {
|
||||||
fill: ${options.nodeBorder};
|
fill: ${options.nodeBorder};
|
||||||
stroke: none;
|
stroke: none;
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
@@ -26,7 +31,7 @@ g.stateGroup line {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.transition {
|
.transition {
|
||||||
stroke: ${options.lineColor};
|
stroke: ${options.transitionColor};
|
||||||
stroke-width: 1;
|
stroke-width: 1;
|
||||||
fill: none;
|
fill: none;
|
||||||
}
|
}
|
||||||
@@ -64,10 +69,10 @@ g.stateGroup line {
|
|||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
}
|
}
|
||||||
.edgeLabel .label text {
|
.edgeLabel .label text {
|
||||||
fill: ${options.tertiaryTextColor};
|
fill: ${options.transitionLabelColor || options.tertiaryTextColor};
|
||||||
}
|
}
|
||||||
.label div .edgeLabel {
|
.label div .edgeLabel {
|
||||||
color: ${options.tertiaryTextColor};
|
color: ${options.transitionLabelColor || options.tertiaryTextColor};
|
||||||
}
|
}
|
||||||
|
|
||||||
.stateLabel text {
|
.stateLabel text {
|
||||||
@@ -86,13 +91,13 @@ g.stateGroup line {
|
|||||||
stroke-width: 1.5
|
stroke-width: 1.5
|
||||||
}
|
}
|
||||||
.end-state-inner {
|
.end-state-inner {
|
||||||
fill: ${options.background};
|
fill: ${options.compositeBackground || options.background};
|
||||||
// stroke: ${options.background};
|
// stroke: ${options.background};
|
||||||
stroke-width: 1.5
|
stroke-width: 1.5
|
||||||
}
|
}
|
||||||
|
|
||||||
.node rect {
|
.node rect {
|
||||||
fill: ${options.mainBkg};
|
fill: ${options.stateBkg || options.mainBkg};
|
||||||
stroke: ${options.nodeBorder};
|
stroke: ${options.nodeBorder};
|
||||||
stroke-width: 1px;
|
stroke-width: 1px;
|
||||||
}
|
}
|
||||||
@@ -106,13 +111,13 @@ g.stateGroup line {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.statediagram-cluster rect {
|
.statediagram-cluster rect {
|
||||||
fill: ${options.mainBkg};
|
fill: ${options.clusterTitleBackground};
|
||||||
stroke: ${options.nodeBorder};
|
stroke: ${options.compositeBorder || options.nodeBorder};
|
||||||
stroke-width: 1px;
|
stroke-width: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cluster-label, .nodeLabel {
|
.cluster-label, .nodeLabel {
|
||||||
color: ${options.textColor};
|
color: ${options.labelColor};
|
||||||
}
|
}
|
||||||
|
|
||||||
.statediagram-cluster rect.outer {
|
.statediagram-cluster rect.outer {
|
||||||
@@ -128,10 +133,10 @@ g.stateGroup line {
|
|||||||
ry: 5px;
|
ry: 5px;
|
||||||
}
|
}
|
||||||
.statediagram-cluster.statediagram-cluster .inner {
|
.statediagram-cluster.statediagram-cluster .inner {
|
||||||
fill: ${options.background};
|
fill: ${options.compositeBackground || options.background};
|
||||||
}
|
}
|
||||||
.statediagram-cluster.statediagram-cluster-alt .inner {
|
.statediagram-cluster.statediagram-cluster-alt .inner {
|
||||||
fill: #e0e0e0;
|
fill: ${options.altBackground ? options.altBackground : '#efefef'};
|
||||||
}
|
}
|
||||||
|
|
||||||
.statediagram-cluster .inner {
|
.statediagram-cluster .inner {
|
||||||
@@ -174,6 +179,9 @@ g.stateGroup line {
|
|||||||
.statediagram-note .nodeLabel {
|
.statediagram-note .nodeLabel {
|
||||||
color: ${options.noteTextColor};
|
color: ${options.noteTextColor};
|
||||||
}
|
}
|
||||||
|
.statediagram .edgeLabel {
|
||||||
|
color: red; // ${options.noteTextColor};
|
||||||
|
}
|
||||||
|
|
||||||
#dependencyStart, #dependencyEnd {
|
#dependencyStart, #dependencyEnd {
|
||||||
fill: ${options.lineColor};
|
fill: ${options.lineColor};
|
||||||
|
@@ -108,10 +108,18 @@ class Theme {
|
|||||||
this.taskTextClickableColor = this.taskTextClickableColor || '#003163';
|
this.taskTextClickableColor = this.taskTextClickableColor || '#003163';
|
||||||
|
|
||||||
/* state colors */
|
/* state colors */
|
||||||
this.labelColor = this.labelColor || this.primaryTextColor;
|
this.transitionColor = this.transitionColor || this.lineColor;
|
||||||
|
this.transitionLabelColor = this.labelColor || this.textColor;
|
||||||
|
this.labelColor = this.labelColor || this.textColor || this.primaryTextColor;
|
||||||
|
this.stateBkg = this.stateBkg || this.mainBkg;
|
||||||
|
this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
|
||||||
this.altBackground = this.altBackground || this.tertiaryColor;
|
this.altBackground = this.altBackground || this.tertiaryColor;
|
||||||
|
this.clusterTitleBackground = this.clusterTitleBackground || this.mainBkg;
|
||||||
|
this.compositeBorder = this.compositeBorder || this.nodeBorder;
|
||||||
|
|
||||||
this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
|
this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
|
||||||
this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
|
this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
|
||||||
|
this.transitionColor = this.transitionColor || this.lineColor;
|
||||||
|
|
||||||
/* class */
|
/* class */
|
||||||
this.classText = this.classText || this.textColor;
|
this.classText = this.classText || this.textColor;
|
||||||
|
Reference in New Issue
Block a user