mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-13 12:29:42 +02:00
#1590 Theme base tweaked for custom theming
This commit is contained in:
@@ -76,7 +76,7 @@ stateDiagram-v2
|
|||||||
</div>
|
</div>
|
||||||
%%{init: {'theme': 'base', 'themeVariables':{ 'primaryColor': '#ff0000'}}}%%
|
%%{init: {'theme': 'base', 'themeVariables':{ 'primaryColor': '#ff0000'}}}%%
|
||||||
<div class="mermaid" style="width: 50%; height: 20%;">
|
<div class="mermaid" style="width: 50%; height: 20%;">
|
||||||
%%{init: {'theme': 'base'}}%%
|
%%{init: {'theme': 'dark'}}%%
|
||||||
|
|
||||||
flowchart TB
|
flowchart TB
|
||||||
subgraph apa
|
subgraph apa
|
||||||
@@ -106,8 +106,8 @@ Note over Bob,Alice: Looks back
|
|||||||
// console.error('Mermaid error: ', err);
|
// console.error('Mermaid error: ', err);
|
||||||
};
|
};
|
||||||
mermaid.initialize({
|
mermaid.initialize({
|
||||||
// theme: 'base',
|
theme: 'forest',
|
||||||
// themeVariables:{primaryColor: '#0000ff'},
|
// themeVariables:{primaryColor: '#ff0000'},
|
||||||
// arrowMarkerAbsolute: true,
|
// arrowMarkerAbsolute: true,
|
||||||
// themeCSS: '.edgePath .path {stroke: red;} .arrowheadPath {fill: red;}',
|
// themeCSS: '.edgePath .path {stroke: red;} .arrowheadPath {fill: red;}',
|
||||||
logLevel: 0,
|
logLevel: 0,
|
||||||
|
@@ -11,7 +11,6 @@
|
|||||||
body {
|
body {
|
||||||
/* background: rgb(221, 208, 208); */
|
/* background: rgb(221, 208, 208); */
|
||||||
background: #f4f4f4;
|
background: #f4f4f4;
|
||||||
/* background: #0c0c0c; */
|
|
||||||
font-family: 'Arial';
|
font-family: 'Arial';
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -177,7 +176,7 @@ gantt
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="mermaid width height2">
|
<div class="mermaid width height2">
|
||||||
%%{init2: {'securityLevel': 'loose', 'theme':'base'}}%%
|
%%{init: {'securityLevel': 'loose', 'theme':'base'}}%%
|
||||||
stateDiagram-v2
|
stateDiagram-v2
|
||||||
[*] --> Active
|
[*] --> Active
|
||||||
|
|
||||||
@@ -234,7 +233,7 @@ journey
|
|||||||
};
|
};
|
||||||
mermaid.initialize({
|
mermaid.initialize({
|
||||||
theme: 'base',
|
theme: 'base',
|
||||||
themeVariables: { primaryColor: '#ff0000'},
|
themeVariables:
|
||||||
// arrowMarkerAbsolute: true,
|
// arrowMarkerAbsolute: true,
|
||||||
// themeCSS: '.edgePath .path {stroke: red;} .arrowheadPath {fill: red;}',
|
// themeCSS: '.edgePath .path {stroke: red;} .arrowheadPath {fill: red;}',
|
||||||
logLevel: 0,
|
logLevel: 0,
|
||||||
|
245
cypress/platform/showcase_base_dark.html
Normal file
245
cypress/platform/showcase_base_dark.html
Normal file
@@ -0,0 +1,245 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<link
|
||||||
|
href="https://fonts.googleapis.com/css?family=Montserrat&display=swap"
|
||||||
|
rel="stylesheet"
|
||||||
|
/>
|
||||||
|
<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
|
||||||
|
<link href="https://fonts.googleapis.com/css?family=Noto+Sans+SC&display=swap" rel="stylesheet">
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
/* background: rgb(221, 208, 208); */
|
||||||
|
background: #f4f4f4;
|
||||||
|
background: #222;
|
||||||
|
font-family: 'Arial';
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
h1 { color: grey;}
|
||||||
|
.mermaid2 {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.height {
|
||||||
|
min-height: 600px;
|
||||||
|
height: 600px;
|
||||||
|
}
|
||||||
|
.height2 {
|
||||||
|
min-height: 600px;
|
||||||
|
height: 1300px;
|
||||||
|
}
|
||||||
|
.width {
|
||||||
|
width: 33%;
|
||||||
|
border: 1px solid blue;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Showcases of diagrams</h1>
|
||||||
|
<div class="flex flex-wrap">
|
||||||
|
<div class="mermaid width height">
|
||||||
|
graph TD
|
||||||
|
A[Christmas] -->|Get money| B(Go shopping)
|
||||||
|
B --> C{Let me think}
|
||||||
|
B --> G[/Another/]
|
||||||
|
C ==>|One| D[Laptop]
|
||||||
|
C -->|Two| E[iPhone]
|
||||||
|
C -->|Three| F[fa:fa-car Car]
|
||||||
|
subgraph section
|
||||||
|
C
|
||||||
|
D
|
||||||
|
E
|
||||||
|
F
|
||||||
|
G
|
||||||
|
end
|
||||||
|
</div>
|
||||||
|
<div class="mermaid width height">
|
||||||
|
%%{init2: {'securityLevel': 'loose', 'theme':'base'}}%%
|
||||||
|
flowchart TD
|
||||||
|
A[Christmas] -->|Get money| B(Go shopping)
|
||||||
|
B --> C{Let me think}
|
||||||
|
B --> G[Another]
|
||||||
|
C ==>|One| D[Laptop]
|
||||||
|
C x--x|Two| E[iPhone]
|
||||||
|
C o--o|Three| F[fa:fa-car Car]
|
||||||
|
subgraph section
|
||||||
|
C
|
||||||
|
D
|
||||||
|
E
|
||||||
|
F
|
||||||
|
G
|
||||||
|
end
|
||||||
|
</div>
|
||||||
|
<div class="mermaid width height" >
|
||||||
|
sequenceDiagram
|
||||||
|
autonumber
|
||||||
|
par Action 1
|
||||||
|
Alice->>John: Hello John, how are you?
|
||||||
|
and Action 2
|
||||||
|
Alice->>Bob: Hello Bob, how are you?
|
||||||
|
end
|
||||||
|
Alice->>+John: Hello John, how are you?
|
||||||
|
Alice->>+John: John, can you hear me?
|
||||||
|
John-->>-Alice: Hi Alice, I can hear you!
|
||||||
|
Note right of John: John is perceptive
|
||||||
|
John-->>-Alice: I feel great!
|
||||||
|
loop Every minute
|
||||||
|
John-->Alice: Great!
|
||||||
|
end
|
||||||
|
</div>
|
||||||
|
<div class="mermaid width height" >
|
||||||
|
classDiagram
|
||||||
|
Animal "1" <|-- Duck
|
||||||
|
Animal <|-- Fish
|
||||||
|
Animal <--o Zebra
|
||||||
|
Animal : +int age
|
||||||
|
Animal : +String gender
|
||||||
|
Animal: +isMammal()
|
||||||
|
Animal: +mate()
|
||||||
|
class Duck{
|
||||||
|
+String beakColor
|
||||||
|
+swim()
|
||||||
|
+quack()
|
||||||
|
}
|
||||||
|
class Fish{
|
||||||
|
-int sizeInFeet
|
||||||
|
-canEat()
|
||||||
|
}
|
||||||
|
class Zebra{
|
||||||
|
+bool is_wild
|
||||||
|
+run()
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
<div class="mermaid width height">
|
||||||
|
gantt
|
||||||
|
dateFormat :YYYY-MM-DD
|
||||||
|
title Adding GANTT diagram functionality to mermaid
|
||||||
|
excludes :excludes the named dates/days from being included in a charted task..
|
||||||
|
section A section
|
||||||
|
Completed task :done, des1, 2014-01-06,2014-01-08
|
||||||
|
Active task :active, des2, 2014-01-09, 3d
|
||||||
|
Future task : des3, after des2, 5d
|
||||||
|
Future task2 : des4, after des3, 5d
|
||||||
|
|
||||||
|
section Critical tasks
|
||||||
|
Completed task in the critical line :crit, done, 2014-01-06,24h
|
||||||
|
Implement parser and jison :crit, done, after des1, 2d
|
||||||
|
Create tests for parser :crit, active, 3d
|
||||||
|
Future task in critical line :crit, 5d
|
||||||
|
Create tests for renderer :2d
|
||||||
|
Add to mermaid :1d
|
||||||
|
|
||||||
|
section Documentation
|
||||||
|
Describe gantt syntax :active, a1, after des1, 3d
|
||||||
|
Add gantt diagram to demo page :after a1 , 20h
|
||||||
|
Add another diagram to demo page :doc1, after a1 , 48h
|
||||||
|
|
||||||
|
section Last section
|
||||||
|
Describe gantt syntax :after doc1, 3d
|
||||||
|
Add gantt diagram to demo page :20h
|
||||||
|
Add another diagram to demo page :48h
|
||||||
|
</div>
|
||||||
|
<div class="mermaid width height2">
|
||||||
|
stateDiagram
|
||||||
|
[*] --> Active
|
||||||
|
|
||||||
|
state Active {
|
||||||
|
[*] --> NumLockOff
|
||||||
|
NumLockOff --> NumLockOn : EvNumLockPressed
|
||||||
|
NumLockOn --> NumLockOff : EvNumLockPressed
|
||||||
|
--
|
||||||
|
[*] --> CapsLockOff
|
||||||
|
CapsLockOff --> CapsLockOn : EvCapsLockPressed
|
||||||
|
CapsLockOn --> CapsLockOff : EvCapsLockPressed
|
||||||
|
--
|
||||||
|
[*] --> ScrollLockOff
|
||||||
|
ScrollLockOff --> ScrollLockOn : EvCapsLockPressed
|
||||||
|
ScrollLockOn --> ScrollLockOff : EvCapsLockPressed
|
||||||
|
}
|
||||||
|
state SomethingElse {
|
||||||
|
A --> B
|
||||||
|
B --> A
|
||||||
|
}
|
||||||
|
|
||||||
|
Active --> SomethingElse
|
||||||
|
note right of SomethingElse : This is the note to the right.
|
||||||
|
|
||||||
|
SomethingElse --> [*]
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="mermaid width height2">
|
||||||
|
stateDiagram-v2
|
||||||
|
[*] --> Active
|
||||||
|
|
||||||
|
state Active {
|
||||||
|
[*] --> NumLockOff
|
||||||
|
NumLockOff --> NumLockOn : EvNumLockPressed
|
||||||
|
NumLockOn --> NumLockOff : EvNumLockPressed
|
||||||
|
--
|
||||||
|
[*] --> CapsLockOff
|
||||||
|
CapsLockOff --> CapsLockOn : EvCapsLockPressed
|
||||||
|
CapsLockOn --> CapsLockOff : EvCapsLockPressed
|
||||||
|
--
|
||||||
|
[*] --> ScrollLockOff
|
||||||
|
ScrollLockOff --> ScrollLockOn : EvCapsLockPressed
|
||||||
|
ScrollLockOn --> ScrollLockOff : EvCapsLockPressed
|
||||||
|
}
|
||||||
|
state SomethingElse {
|
||||||
|
A --> B
|
||||||
|
B --> A
|
||||||
|
}
|
||||||
|
|
||||||
|
Active --> SomethingElse2
|
||||||
|
note right of SomethingElse2 : This is the note to the right.
|
||||||
|
|
||||||
|
SomethingElse2 --> [*]
|
||||||
|
</div>
|
||||||
|
<div class="mermaid width height2">
|
||||||
|
erDiagram
|
||||||
|
CUSTOMER }|..|{ DELIVERY-ADDRESS : has
|
||||||
|
CUSTOMER ||--o{ ORDER : places
|
||||||
|
CUSTOMER ||--o{ INVOICE : "liable for"
|
||||||
|
DELIVERY-ADDRESS ||--o{ ORDER : receives
|
||||||
|
INVOICE ||--|{ ORDER : covers
|
||||||
|
ORDER ||--|{ ORDER-ITEM : includes
|
||||||
|
PRODUCT-CATEGORY ||--|{ PRODUCT : contains
|
||||||
|
PRODUCT ||--o{ ORDER-ITEM : "ordered in"
|
||||||
|
</div>
|
||||||
|
<div class="mermaid width height">
|
||||||
|
journey
|
||||||
|
title My working day
|
||||||
|
section Go to work
|
||||||
|
Make tea: 5: Me
|
||||||
|
Go upstairs: 3: Me
|
||||||
|
Do work: 1: Me, Cat
|
||||||
|
section Go home
|
||||||
|
Go downstairs: 5: Me
|
||||||
|
Sit down: 5: Me
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="./mermaid.js"></script>
|
||||||
|
<script>
|
||||||
|
mermaid.parseError = function (err, hash) {
|
||||||
|
// console.error('Mermaid error: ', err);
|
||||||
|
};
|
||||||
|
mermaid.initialize({
|
||||||
|
theme: 'base',
|
||||||
|
themeVariables: { primaryColor: '#9400D3', darkMode: true, background: '#222'},
|
||||||
|
// arrowMarkerAbsolute: true,
|
||||||
|
// themeCSS: '.edgePath .path {stroke: red;} .arrowheadPath {fill: red;}',
|
||||||
|
logLevel: 0,
|
||||||
|
flowchart: { curve: 'cardinal', "htmlLabels": false },
|
||||||
|
// gantt: { axisFormat: '%m/%d/%Y' },
|
||||||
|
sequence: { actorMargin: 50, showSequenceNumbers: true },
|
||||||
|
// sequenceDiagram: { actorMargin: 300 } // deprecated
|
||||||
|
fontFamily: '"arial", sans-serif',
|
||||||
|
curve: 'cardinal',
|
||||||
|
// securityLevel: 'strict'
|
||||||
|
});
|
||||||
|
function callback(){alert('It worked');}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@@ -166,6 +166,7 @@ gantt
|
|||||||
}
|
}
|
||||||
|
|
||||||
Active --> SomethingElse
|
Active --> SomethingElse
|
||||||
|
SomethingElse --> [*]
|
||||||
note right of SomethingElse : This is the note to the right.
|
note right of SomethingElse : This is the note to the right.
|
||||||
</div>
|
</div>
|
||||||
<div class="mermaid width height2">
|
<div class="mermaid width height2">
|
||||||
@@ -191,6 +192,7 @@ gantt
|
|||||||
}
|
}
|
||||||
|
|
||||||
Active --> SomethingElse2
|
Active --> SomethingElse2
|
||||||
|
SomethingElse2 --> [*]
|
||||||
note right of SomethingElse2 : This is the note to the right.
|
note right of SomethingElse2 : This is the note to the right.
|
||||||
</div>
|
</div>
|
||||||
<div class="mermaid width height2">
|
<div class="mermaid width height2">
|
||||||
|
@@ -167,6 +167,7 @@ gantt
|
|||||||
|
|
||||||
Active --> SomethingElse
|
Active --> SomethingElse
|
||||||
note right of SomethingElse : This is the note to the right.
|
note right of SomethingElse : This is the note to the right.
|
||||||
|
SomethingElse --> [*]
|
||||||
</div>
|
</div>
|
||||||
<div class="mermaid width height2">
|
<div class="mermaid width height2">
|
||||||
stateDiagram-v2
|
stateDiagram-v2
|
||||||
|
@@ -20,12 +20,14 @@ export const updateCurrentConfig = (siteCfg, _directives) => {
|
|||||||
const d = _directives[i];
|
const d = _directives[i];
|
||||||
sanitize(d);
|
sanitize(d);
|
||||||
cfg = assignWithDepth(cfg, d);
|
cfg = assignWithDepth(cfg, d);
|
||||||
if (d.themeVariables) {
|
if (d.theme) {
|
||||||
themeVariables = d.themeVariables;
|
cfg.themeVariables = theme[cfg.theme].getThemeVariables(d.themeVariables);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cfg.theme && theme[cfg.theme]) {
|
if (cfg.theme && theme[cfg.theme]) {
|
||||||
const variables = theme[cfg.theme].getThemeVariables(themeVariables);
|
let tVars = assignWithDepth({}, cfg.themeVariables);
|
||||||
|
tVars = assignWithDepth(tVars, themeVariables);
|
||||||
|
const variables = theme[cfg.theme].getThemeVariables(tVars);
|
||||||
cfg.themeVariables = variables;
|
cfg.themeVariables = variables;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,8 +49,14 @@ export const updateCurrentConfig = (siteCfg, _directives) => {
|
|||||||
* @returns {*} - the siteConfig
|
* @returns {*} - the siteConfig
|
||||||
*/
|
*/
|
||||||
export const setSiteConfig = conf => {
|
export const setSiteConfig = conf => {
|
||||||
|
console.warn('Setting site config');
|
||||||
siteConfig = assignWithDepth({}, defaultConfig);
|
siteConfig = assignWithDepth({}, defaultConfig);
|
||||||
siteConfig = assignWithDepth(siteConfig, conf);
|
siteConfig = assignWithDepth(siteConfig, conf);
|
||||||
|
|
||||||
|
if (conf.theme) {
|
||||||
|
siteConfig.themeVariables = theme[conf.theme].getThemeVariables(conf.themeVariables);
|
||||||
|
}
|
||||||
|
|
||||||
currentConfig = updateCurrentConfig(siteConfig, directives);
|
currentConfig = updateCurrentConfig(siteConfig, directives);
|
||||||
return siteConfig;
|
return siteConfig;
|
||||||
};
|
};
|
||||||
|
@@ -468,7 +468,7 @@ export const draw = function(text, id) {
|
|||||||
rect.setAttribute('ry', 0);
|
rect.setAttribute('ry', 0);
|
||||||
rect.setAttribute('width', dim.width);
|
rect.setAttribute('width', dim.width);
|
||||||
rect.setAttribute('height', dim.height);
|
rect.setAttribute('height', dim.height);
|
||||||
rect.setAttribute('style', 'fill:#e8e8e8;');
|
// rect.setAttribute('style', 'fill:#e8e8e8;');
|
||||||
|
|
||||||
label.insertBefore(rect, label.firstChild);
|
label.insertBefore(rect, label.firstChild);
|
||||||
}
|
}
|
||||||
|
@@ -14,8 +14,9 @@ import { logger } from '../../logger';
|
|||||||
export const drawStartState = g =>
|
export const drawStartState = g =>
|
||||||
g
|
g
|
||||||
.append('circle')
|
.append('circle')
|
||||||
.style('stroke', 'black')
|
// .style('stroke', 'black')
|
||||||
.style('fill', 'black')
|
// .style('fill', 'black')
|
||||||
|
.attr('class', 'start-state')
|
||||||
.attr('r', getConfig().state.sizeUnit)
|
.attr('r', getConfig().state.sizeUnit)
|
||||||
.attr('cx', getConfig().state.padding + getConfig().state.sizeUnit)
|
.attr('cx', getConfig().state.padding + getConfig().state.sizeUnit)
|
||||||
.attr('cy', getConfig().state.padding + getConfig().state.sizeUnit);
|
.attr('cy', getConfig().state.padding + getConfig().state.sizeUnit);
|
||||||
@@ -241,8 +242,9 @@ export const addTitleAndBox = (g, stateDef, altBkg) => {
|
|||||||
|
|
||||||
const drawEndState = g => {
|
const drawEndState = g => {
|
||||||
g.append('circle')
|
g.append('circle')
|
||||||
.style('stroke', 'black')
|
// .style('stroke', 'black')
|
||||||
.style('fill', 'white')
|
// .style('fill', 'white')
|
||||||
|
.attr('class', 'end-state-outer')
|
||||||
.attr('r', getConfig().state.sizeUnit + getConfig().state.miniPadding)
|
.attr('r', getConfig().state.sizeUnit + getConfig().state.miniPadding)
|
||||||
.attr(
|
.attr(
|
||||||
'cx',
|
'cx',
|
||||||
@@ -253,13 +255,16 @@ const drawEndState = g => {
|
|||||||
getConfig().state.padding + getConfig().state.sizeUnit + getConfig().state.miniPadding
|
getConfig().state.padding + getConfig().state.sizeUnit + getConfig().state.miniPadding
|
||||||
);
|
);
|
||||||
|
|
||||||
return g
|
return (
|
||||||
|
g
|
||||||
.append('circle')
|
.append('circle')
|
||||||
.style('stroke', 'black')
|
// .style('stroke', 'black')
|
||||||
.style('fill', 'black')
|
// .style('fill', 'black')
|
||||||
|
.attr('class', 'end-state-inner')
|
||||||
.attr('r', getConfig().state.sizeUnit)
|
.attr('r', getConfig().state.sizeUnit)
|
||||||
.attr('cx', getConfig().state.padding + getConfig().state.sizeUnit + 2)
|
.attr('cx', getConfig().state.padding + getConfig().state.sizeUnit + 2)
|
||||||
.attr('cy', getConfig().state.padding + getConfig().state.sizeUnit + 2);
|
.attr('cy', getConfig().state.padding + getConfig().state.sizeUnit + 2)
|
||||||
|
);
|
||||||
};
|
};
|
||||||
const drawForkJoinState = (g, stateDef) => {
|
const drawForkJoinState = (g, stateDef) => {
|
||||||
let width = getConfig().state.forkWidth;
|
let width = getConfig().state.forkWidth;
|
||||||
|
@@ -81,7 +81,7 @@ g.stateGroup line {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.node circle.state-start {
|
.node circle.state-start {
|
||||||
fill: ${options.primaryBorderColor};
|
fill: ${options.lineColor};
|
||||||
stroke: black;
|
stroke: black;
|
||||||
}
|
}
|
||||||
.node circle.state-end {
|
.node circle.state-end {
|
||||||
@@ -89,6 +89,11 @@ g.stateGroup line {
|
|||||||
stroke: ${options.background};
|
stroke: ${options.background};
|
||||||
stroke-width: 1.5
|
stroke-width: 1.5
|
||||||
}
|
}
|
||||||
|
.end-state-inner {
|
||||||
|
fill: ${options.background};
|
||||||
|
// stroke: ${options.background};
|
||||||
|
stroke-width: 1.5
|
||||||
|
}
|
||||||
|
|
||||||
.node rect {
|
.node rect {
|
||||||
fill: ${options.mainBkg};
|
fill: ${options.mainBkg};
|
||||||
|
@@ -129,7 +129,7 @@ const init = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const initialize = function(config) {
|
const initialize = function(config) {
|
||||||
mermaidAPI.reset();
|
// mermaidAPI.reset();
|
||||||
if (typeof config.mermaid !== 'undefined') {
|
if (typeof config.mermaid !== 'undefined') {
|
||||||
if (typeof config.mermaid.startOnLoad !== 'undefined') {
|
if (typeof config.mermaid.startOnLoad !== 'undefined') {
|
||||||
mermaid.startOnLoad = config.mermaid.startOnLoad;
|
mermaid.startOnLoad = config.mermaid.startOnLoad;
|
||||||
|
@@ -220,7 +220,7 @@ const render = function(id, _txt, cb, container) {
|
|||||||
// console.warn('Render fetching config');
|
// console.warn('Render fetching config');
|
||||||
|
|
||||||
const cnf = configApi.getConfig();
|
const cnf = configApi.getConfig();
|
||||||
// console.warn('Render with config after adding new directives', cnf.themeVariables.mainBkg);
|
console.warn('Render with config after adding new directives', cnf.themeVariables.primaryColor);
|
||||||
// Check the maximum allowed text size
|
// Check the maximum allowed text size
|
||||||
if (_txt.length > cnf.maxTextSize) {
|
if (_txt.length > cnf.maxTextSize) {
|
||||||
txt = 'graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa';
|
txt = 'graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa';
|
||||||
@@ -552,7 +552,7 @@ function reinitialize() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function initialize(options) {
|
function initialize(options) {
|
||||||
logger.debug(`mermaidAPI.initialize: v${pkg.version} ${options}`);
|
console.warn(`mermaidAPI.initialize: v${pkg.version} `, options);
|
||||||
// Set default options
|
// Set default options
|
||||||
|
|
||||||
if (options && options.theme && theme[options.theme]) {
|
if (options && options.theme && theme[options.theme]) {
|
||||||
|
@@ -4,18 +4,21 @@ class Theme {
|
|||||||
constructor() {
|
constructor() {
|
||||||
/** # Base variables */
|
/** # Base variables */
|
||||||
/** * background - used to know what the background color is of the diagram. This is used for deducing colors for istance line color. Defaulr value is #f4f4f4. */
|
/** * background - used to know what the background color is of the diagram. This is used for deducing colors for istance line color. Defaulr value is #f4f4f4. */
|
||||||
this.primaryColor = '#fff4dd';
|
|
||||||
this.primaryTextColor = this.darkMode ? '#ddd' : '#333'; // invert(this.primaryColor);
|
|
||||||
this.background = '#f4f4f4';
|
this.background = '#f4f4f4';
|
||||||
// this.background = '#0c0c0c';
|
// this.background = '#0c0c0c';
|
||||||
|
// this.darkMode = true;
|
||||||
|
this.primaryColor = '#fff4dd';
|
||||||
|
// this.background = '#0c0c0c';
|
||||||
/** * darkMode -In darkMode the color generation deduces other colors from the primary colors */
|
/** * darkMode -In darkMode the color generation deduces other colors from the primary colors */
|
||||||
this.darkMode = false;
|
this.darkMode = false;
|
||||||
// this.primaryColor = '#1f1f00';
|
// this.primaryColor = '#1f1f00';
|
||||||
// this.darkMode = true;
|
|
||||||
|
|
||||||
this.noteBkgColor = '#fff5ad';
|
this.noteBkgColor = '#fff5ad';
|
||||||
this.noteTextColor = '#333';
|
this.noteTextColor = '#333';
|
||||||
|
|
||||||
|
// dark
|
||||||
|
|
||||||
|
// this.primaryColor = '#034694';
|
||||||
// this.primaryColor = '#f2ee7e';
|
// this.primaryColor = '#f2ee7e';
|
||||||
// this.primaryColor = '#9f33be';
|
// this.primaryColor = '#9f33be';
|
||||||
// this.primaryColor = '#f0fff0';
|
// this.primaryColor = '#f0fff0';
|
||||||
@@ -32,7 +35,6 @@ class Theme {
|
|||||||
this.arrowheadColor = '#333333';
|
this.arrowheadColor = '#333333';
|
||||||
this.fontFamily = '"trebuchet ms", verdana, arial';
|
this.fontFamily = '"trebuchet ms", verdana, arial';
|
||||||
this.fontSize = '16px';
|
this.fontSize = '16px';
|
||||||
this.textColor = '#333';
|
|
||||||
this.updateColors();
|
this.updateColors();
|
||||||
this.relationColor = '#000';
|
this.relationColor = '#000';
|
||||||
}
|
}
|
||||||
@@ -40,6 +42,7 @@ class Theme {
|
|||||||
this.secondBkg = this.tertiaryColor;
|
this.secondBkg = this.tertiaryColor;
|
||||||
|
|
||||||
/* Main */
|
/* Main */
|
||||||
|
this.primaryTextColor = this.darkMode ? '#ddd' : '#333'; // invert(this.primaryColor);
|
||||||
this.secondaryColor = adjust(this.primaryColor, { h: -120 });
|
this.secondaryColor = adjust(this.primaryColor, { h: -120 });
|
||||||
this.tertiaryColor = adjust(this.primaryColor, { h: 180, l: 5 });
|
this.tertiaryColor = adjust(this.primaryColor, { h: 180, l: 5 });
|
||||||
|
|
||||||
@@ -51,7 +54,7 @@ class Theme {
|
|||||||
this.secondaryTextColor = invert(this.secondaryColor);
|
this.secondaryTextColor = invert(this.secondaryColor);
|
||||||
this.tertiaryTextColor = invert(this.tertiaryColor);
|
this.tertiaryTextColor = invert(this.tertiaryColor);
|
||||||
this.lineColor = invert(this.background);
|
this.lineColor = invert(this.background);
|
||||||
this.textColor = invert(this.background);
|
this.textColor = this.primaryTextColor;
|
||||||
|
|
||||||
/* Flowchart variables */
|
/* Flowchart variables */
|
||||||
|
|
||||||
@@ -63,7 +66,9 @@ class Theme {
|
|||||||
this.clusterBorder = this.tertiaryBorderColor;
|
this.clusterBorder = this.tertiaryBorderColor;
|
||||||
this.defaultLinkColor = this.lineColor;
|
this.defaultLinkColor = this.lineColor;
|
||||||
this.titleColor = this.tertiaryTextColor;
|
this.titleColor = this.tertiaryTextColor;
|
||||||
this.edgeLabelBackground = this.secondaryColor;
|
this.edgeLabelBackground = this.darkMode
|
||||||
|
? darken(this.secondaryColor, 30)
|
||||||
|
: this.secondaryColor;
|
||||||
|
|
||||||
/* Sequence Diagram variables */
|
/* Sequence Diagram variables */
|
||||||
|
|
||||||
@@ -81,7 +86,7 @@ class Theme {
|
|||||||
// this.noteTextColor = this.actorTextColor;
|
// this.noteTextColor = this.actorTextColor;
|
||||||
this.activationBorderColor = darken(this.secondaryColor, 10);
|
this.activationBorderColor = darken(this.secondaryColor, 10);
|
||||||
this.activationBkgColor = this.secondaryColor;
|
this.activationBkgColor = this.secondaryColor;
|
||||||
this.sequenceNumberColor = 'white';
|
this.sequenceNumberColor = invert(this.lineColor);
|
||||||
|
|
||||||
/* Gantt chart variables */
|
/* Gantt chart variables */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user