Adding default node form

This commit is contained in:
Knut Sveidqvist
2022-07-27 09:43:25 +02:00
parent 0b2ca29ae8
commit 03d71829c6
5 changed files with 91 additions and 27 deletions

View File

@@ -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 {