Skip to content

Commit 6f35e25

Browse files
mejo-backportbot[bot]
authored andcommitted
fix(mermaid): Use dark theme if appropriate
Fixes: #4814 Signed-off-by: Jonas <jonas@freesources.org> [skip ci]
1 parent a4b6370 commit 6f35e25

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/nodes/CodeBlockView.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,9 @@ export default {
131131
},
132132
},
133133
setup() {
134+
const isDarkTheme = useIsDarkTheme()
134135
return {
136+
isDarkTheme,
135137
/** The lazy loaded mermaid js module */
136138
mermaid: null,
137139
}
@@ -209,7 +211,10 @@ export default {
209211
// lazy load mermaid on first real usage
210212
if (this.mermaid === null) {
211213
this.mermaid = (await import('mermaid')).default
212-
this.mermaid.initialize({ startOnLoad: false })
214+
this.mermaid.initialize({
215+
startOnLoad: false,
216+
theme: this.isDarkTheme ? 'dark' : 'default',
217+
})
213218
}
214219
await this.mermaid.parse(textContent)
215220

0 commit comments

Comments
 (0)