-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: patch mermaid to support auto dark mode
- Loading branch information
1 parent
2062ce1
commit 0803270
Showing
3 changed files
with
23 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,7 +67,8 @@ | |
}, | ||
"pnpm": { | ||
"patchedDependencies": { | ||
"[email protected]": "patches/[email protected]" | ||
"[email protected]": "patches/[email protected]", | ||
"[email protected]": "patches/[email protected]" | ||
} | ||
}, | ||
"version": "0.4.0" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
diff --git a/dist/mermaid.js b/dist/mermaid.js | ||
index ef05f6a0f4869895ecfde055ca295b38f46fbf46..561793e757be9f0dfe90b339d01038dd77553242 100644 | ||
--- a/dist/mermaid.js | ||
+++ b/dist/mermaid.js | ||
@@ -14640,8 +14640,9 @@ ${config2.themeCSS}`; | ||
const firstChild = svg2.firstChild; | ||
const diagramClassDefs = (_b2 = (_a2 = diag.renderer).getClasses) == null ? void 0 : _b2.call(_a2, text2, diag); | ||
const rules = createUserStyles(config2, diagramType, diagramClassDefs, idSelector); | ||
+ const rulesDark = createUserStyles({...config2, themeVariables: theme.dark.getThemeVariables({})}, diagramType, diagramClassDefs, idSelector); | ||
const style1 = document.createElement("style"); | ||
- style1.innerHTML = rules; | ||
+ style1.innerHTML = rules + `@media (prefers-color-scheme: dark) {${rulesDark}}`; | ||
svg2.insertBefore(style1, firstChild); | ||
try { | ||
await diag.renderer.draw(text2, id2, version$1, diag); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.