mirror of
https://github.com/docmost/docmost.git
synced 2025-11-10 05:02:06 +10:00
feat: set mermaid theme based on computed color scheme (#1397)
Use Mantine's `useComputedColorScheme` hook to dynamically configure mermaid's theme. - When the computed color scheme is "light", the theme is set to "default". - Otherwise, it is set to "dark".
This commit is contained in:
committed by
GitHub
parent
b30bf61dc4
commit
32c7ecd9cf
@ -4,10 +4,14 @@ import mermaid from "mermaid";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import classes from "./code-block.module.css";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useComputedColorScheme } from "@mantine/core";
|
||||
|
||||
const computedColorScheme = useComputedColorScheme();
|
||||
|
||||
mermaid.initialize({
|
||||
startOnLoad: false,
|
||||
suppressErrorRendering: true,
|
||||
theme: computedColorScheme === "light" ? "default" : "dark",
|
||||
});
|
||||
|
||||
interface MermaidViewProps {
|
||||
|
||||
Reference in New Issue
Block a user