Skip to content

Commit 7c6c275

Browse files
committed
fix(): refine mermaid label style
1 parent 3c4fbe5 commit 7c6c275

File tree

1 file changed

+25
-13
lines changed

1 file changed

+25
-13
lines changed

shared/markdown/src/rehypeMermaid.ts

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ export function rehypeMermaid() {
5555
);
5656
defs.innerHTML = `<linearGradient id="linear-gradient-${id}" x1="0%" y1="0%" x2="0%" y2="100%">
5757
<stop offset="0%" stop-color="#F0EBFA" />
58-
<stop offset="100%" stop-color="#DCD2F3" />
58+
<stop offset="75%" stop-color="#DED4F4" />
59+
<stop offset="100%" stop-color="#C5C7FA" />
5960
</linearGradient>`;
6061
svgElement.prepend(defs);
6162

@@ -64,18 +65,29 @@ export function rehypeMermaid() {
6465
"style"
6566
);
6667
style.textContent = `
67-
#${id} .node rect,
68-
#${id} .node circle,
69-
#${id} .node ellipse,
70-
#${id} .node polygon,
71-
#${id} .node path {
72-
fill: url(#linear-gradient-${id});
73-
}
74-
#${id} .node rect {
75-
rx: 4;
76-
ry: 4;
77-
}
78-
`;
68+
#${id} .node rect,
69+
#${id} .node circle,
70+
#${id} .node ellipse,
71+
#${id} .node polygon,
72+
#${id} .node path {
73+
fill: url(#linear-gradient-${id});
74+
}
75+
#${id} .node rect {
76+
rx: 4;
77+
ry: 4;
78+
}
79+
#${id} .labelBkg {
80+
background-color: #f5f8ff;
81+
}
82+
#${id} .edgeLabel,
83+
#${id} .edgeLabel p {
84+
background-color: transparent;
85+
}
86+
#${id} .edgeLabel {
87+
color: #8c8c8c;
88+
font-size: 12px;
89+
}
90+
`;
7991
svgElement.appendChild(style);
8092

8193
const modifiedSvg = serializer.serializeToString(svgElement);

0 commit comments

Comments
 (0)