chore: use mermaid default light and dark theme (#425)

uci-hugo-doc
Robert Kaussow 2022-05-30 21:26:43 +02:00 committed by GitHub
parent 51afa9db79
commit bea2551628
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 5 deletions

View File

@ -5,22 +5,21 @@ document.addEventListener("DOMContentLoaded", function (event) {
let lstore = Storage.namespace(THEME) let lstore = Storage.namespace(THEME)
let currentMode = lstore.get("color-mode") let currentMode = lstore.get("color-mode")
let darkModeQuery = window.matchMedia("(prefers-color-scheme: dark)") let darkModeQuery = window.matchMedia("(prefers-color-scheme: dark)")
let primaryColor = "#ececff"
let darkMode = false let darkMode = false
let theme = "default"
if (currentMode === DARK_MODE || (currentMode === AUTO_MODE && darkModeQuery.matches)) { if (currentMode === DARK_MODE || (currentMode === AUTO_MODE && darkModeQuery.matches)) {
primaryColor = "#6C617E"
darkMode = true darkMode = true
theme = "dark"
} }
import("mermaid") import("mermaid")
.then(({ default: md }) => { .then(({ default: md }) => {
md.initialize({ md.initialize({
flowchart: { useMaxWidth: true }, flowchart: { useMaxWidth: true },
theme: "base", theme: theme,
themeVariables: { themeVariables: {
darkMode: darkMode, darkMode: darkMode
primaryColor: primaryColor
} }
}) })
}) })