mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-10-11 10:09:39 +02:00
Fix styling of erBox rows
This commit is contained in:
@@ -30,7 +30,7 @@ const getStyles = (options: FlowChartStyleOptions) =>
|
|||||||
}
|
}
|
||||||
|
|
||||||
.labelBkg {
|
.labelBkg {
|
||||||
background-color: ${fade(options.edgeLabelBackground, 0.5)};
|
background-color: ${fade(options.tertiaryColor, 0.5)};
|
||||||
}
|
}
|
||||||
|
|
||||||
.edgeLabel .label {
|
.edgeLabel .label {
|
||||||
|
@@ -142,7 +142,6 @@ export async function erBox<T extends SVGGraphicsElement>(parent: D3Selection<T>
|
|||||||
TEXT_PADDING;
|
TEXT_PADDING;
|
||||||
yOffsets.push(yOffset);
|
yOffsets.push(yOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
yOffsets.pop();
|
yOffsets.pop();
|
||||||
let totalWidthSections = 4;
|
let totalWidthSections = 4;
|
||||||
|
|
||||||
@@ -228,6 +227,24 @@ export async function erBox<T extends SVGGraphicsElement>(parent: D3Selection<T>
|
|||||||
const roughRect = rc.rectangle(x, y, w, h, options);
|
const roughRect = rc.rectangle(x, y, w, h, options);
|
||||||
const rect = shapeSvg.insert(() => roughRect, ':first-child').attr('style', cssStyles!.join(''));
|
const rect = shapeSvg.insert(() => roughRect, ':first-child').attr('style', cssStyles!.join(''));
|
||||||
|
|
||||||
|
const { themeVariables } = getConfig();
|
||||||
|
const { secondaryColor, tertiaryColor, nodeBorder } = themeVariables;
|
||||||
|
|
||||||
|
yOffsets.push(0);
|
||||||
|
// Draw row rects
|
||||||
|
for (const [i, yOffset] of yOffsets.entries()) {
|
||||||
|
const isEven = i % 2 === 0 && yOffset !== 0;
|
||||||
|
const roughRect = rc.rectangle(x, nameBBox.height + y + yOffset, w, nameBBox.height, {
|
||||||
|
...options,
|
||||||
|
fill: isEven ? tertiaryColor : secondaryColor,
|
||||||
|
stroke: nodeBorder,
|
||||||
|
});
|
||||||
|
shapeSvg
|
||||||
|
.insert(() => roughRect, 'g.label')
|
||||||
|
.attr('style', cssStyles!.join(''))
|
||||||
|
.attr('class', `row-rect-${i % 2 === 0 ? 'even' : 'odd'}`);
|
||||||
|
}
|
||||||
|
|
||||||
// Draw divider lines
|
// Draw divider lines
|
||||||
// Name line
|
// Name line
|
||||||
let roughLine = rc.line(x, nameBBox.height + y, w + x, nameBBox.height + y, options);
|
let roughLine = rc.line(x, nameBBox.height + y, w + x, nameBBox.height + y, options);
|
||||||
|
Reference in New Issue
Block a user