mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-19 15:30:03 +02:00
Adding default node form
This commit is contained in:
@@ -1,9 +1,21 @@
|
||||
import { darken, lighten, adjust, invert, isDark } from 'khroma';
|
||||
|
||||
const genSections = (options) => {
|
||||
let sections = '';
|
||||
|
||||
for (let i = 0; i < 8; i++) {
|
||||
options['lineColor' + i] = options['lineColor' + i] || options['gitBranchLabel' + i];
|
||||
if (isDark(options['lineColor' + i])) {
|
||||
options['lineColor' + i] = lighten(options['lineColor' + i], 30);
|
||||
} else {
|
||||
options['lineColor' + i] = darken(options['lineColor' + i], 30);
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = 1; i < 8; i++) {
|
||||
const sw = '' + (17 - 3 * i);
|
||||
sections += `
|
||||
.section-${i - 1} rect {
|
||||
.section-${i - 1} rect, .section-${i - 1} path {
|
||||
fill: ${options['git' + i]};
|
||||
}
|
||||
.section-${i - 1} text {
|
||||
@@ -15,6 +27,10 @@ const genSections = (options) => {
|
||||
.edge-depth-${i - 1}{
|
||||
stroke-width: ${sw};
|
||||
}
|
||||
.section-${i - 1} line {
|
||||
stroke: ${options['lineColor' + i]} ;
|
||||
stroke-width: 3;
|
||||
}
|
||||
`;
|
||||
}
|
||||
return sections;
|
||||
@@ -26,7 +42,7 @@ const getStyles = (options) =>
|
||||
stroke-width: 3;
|
||||
}
|
||||
${genSections(options)}
|
||||
.section-root rect {
|
||||
.section-root rect, .section-root path {
|
||||
fill: ${options.git0};
|
||||
}
|
||||
.section-root text {
|
||||
|
Reference in New Issue
Block a user