Skip to content

Commit 4cec7ff

Browse files
mejo-backportbot[bot]
authored andcommitted
fix(mermaid): Use dark theme if appropriate
Fixes: #4814 Signed-off-by: Jonas <[email protected]> [skip ci]
1 parent 092b3e4 commit 4cec7ff

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/nodes/CodeBlock/CodeBlockView.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,9 @@ export default {
130130
},
131131
},
132132
setup() {
133+
const isDarkTheme = useIsDarkTheme()
133134
return {
135+
isDarkTheme,
134136
/** The lazy loaded mermaid js module */
135137
mermaid: null,
136138
}
@@ -208,7 +210,10 @@ export default {
208210
// lazy load mermaid on first real usage
209211
if (this.mermaid === null) {
210212
this.mermaid = (await import('mermaid')).default
211-
this.mermaid.initialize({ startOnLoad: false })
213+
this.mermaid.initialize({
214+
startOnLoad: false,
215+
theme: this.isDarkTheme ? 'dark' : 'default',
216+
})
212217
}
213218
await this.mermaid.parse(textContent)
214219

0 commit comments

Comments
 (0)