Skip to content

Commit c3181fc

Browse files
authored
Merge pull request #1 from evan-bradley/mx-psi/style-improvements
Add CSS styling for diagrams
2 parents f3c4a45 + ac572ff commit c3181fc

5 files changed

+48
-12
lines changed

diagram/config.json

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
{
22
"theme": "base",
33
"themeVariables": {
4-
"primaryColor": "#CEDEF3",
5-
"primaryTextColor": "#000",
6-
"primaryBorderColor": "#ADC8EB",
7-
"lineColor": "#ADC8EB",
8-
"secondaryColor": "#CEDEF3",
9-
"tertiaryColor": "#CEDEF3",
10-
"tertiaryBorderColor": "#ADC8EB",
11-
"tertiaryTextColor": "#000",
4+
"primaryColor": "#ffffff",
5+
"primaryTextColor": "#7d88a1",
6+
"primaryBorderColor": "#ffffff",
7+
"lineColor": "#8ea9ec",
8+
"secondaryColor": "#e8f6fc",
9+
"secondaryBorderColor": "#e8f6fc",
10+
"tertiaryColor": "#e8f6fc",
11+
"tertiaryBorderColor": "#e8f6fc",
12+
"tertiaryTextColor": "#0778d4",
1213
"fontFamily": "Montserrat"
1314
}
14-
}
15+
}

diagram/custom-distro-releasing.mmd

+4-1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,7 @@ flowchart LR
2626
end
2727

2828
artifacts["fa:fa-cube Artifacts"]
29-
release2 --> artifacts
29+
release2 --> artifacts
30+
31+
class PR,main,Release,uu,Hotfix,Testing,release2,artifacts box;
32+
class upstream,distro container;

diagram/ocb-build-pipeline.mmd

+3
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ flowchart LR
1212
manifest --> ocb
1313
ocb --> code
1414
code -->|" go build "| bin
15+
16+
class manifest,tmpl,code,bin box;
17+
class ocb container;

diagram/theme.css

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
This file is used to style all diagram.
3+
Use the 'class' directive to style a specific element.
4+
Note that SVG elements do not support all CSS properties.
5+
*/
6+
7+
.box rect {
8+
/* Add subtle shadow to boxes. SVG does not support box-shadow. */
9+
filter:drop-shadow( 0px 0px 3px rgb(213, 213, 213)) !important;
10+
/* Round corners of boxes. SVG does not support border-radius. */
11+
rx: 4 !important;
12+
ry: 4 !important;
13+
}
14+
15+
/* The label of nodes has class 'nodeLabel' */
16+
.container .nodeLabel {
17+
font-weight: 600 !important;
18+
}
19+
20+
/* The label is inside a foreignObject element */
21+
.container foreignObject {
22+
/* HACK:
23+
Mermaid seems to calculate the spacing using the default font style.
24+
This means changes in font family or weight can lead to text overflowing the box.
25+
This is a workaround to show the text correctly. It won't work in some cases.
26+
*/
27+
overflow: visible !important;
28+
}
29+

render.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ for dir in ${directories}; do
1212
files=$(find . -iname '*.mmd' -type f)
1313
rm -f output/*.png
1414
for file in $files; do
15-
docker run --rm -u $(id -u):$(id -g) -v $(pwd):/data mermaid-cli-fonts -c config.json -s 20 -i ${file} -o output/$(basename ${file}).png
15+
docker run --rm -u $(id -u):$(id -g) -v $(pwd):/data mermaid-cli-fonts -c config.json --cssFile theme.css -b transparent -s 25 -i ${file} -o output/$(basename ${file}).png
1616
done
1717

1818
popd
19-
done
19+
done

0 commit comments

Comments
 (0)