You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I note when switching themes between dark/light, the background color is also changing, aka data-theme="dark". But things are different when it comes to mermaid charts. There is neither option to set mermaid color theme, nor dynamic reload when you change page theme from light to dark. This makes the black lines nearly disappear in the dark theme.
Description
Mermaid is introduced in file layouts/partials/third-party/mermaid.html. There should be an option to specify theme in one of four candidates: ["default", "forest", "dark", "neutral"], refer to mermaid source code. When MEME load mermaid, the chart will be displayed in default color theme, which will make the black lines almost vanish! For example, in my blog, the last chart in dark theme.
Suggestions
I did some Googling and tests in and find two ways to solve it. The first one is easy but kind of stupid, while the second one is superior but needs more coding.
In mermaid.html mentioned above, directly specify theme: 'forest'. Or add an option in config.toml and let users decide.
Re-render charts when switch page theme
Available approaches do this by this function: mermaid.init. First remove data-processed property, which make mermaid thinks the DOM nodes are not processed. Then, render them with new parameters.
Summary
I note when switching themes between dark/light, the background color is also changing, aka
data-theme="dark"
. But things are different when it comes to mermaid charts. There is neither option to set mermaid color theme, nor dynamic reload when you change page theme from light to dark. This makes the black lines nearly disappear in the dark theme.Description
Mermaid is introduced in file layouts/partials/third-party/mermaid.html. There should be an option to specify
theme
in one of four candidates:["default", "forest", "dark", "neutral"]
, refer to mermaid source code. When MEME load mermaid, the chart will be displayed indefault
color theme, which will make the black lines almost vanish! For example, in my blog, the last chart in dark theme.Suggestions
I did some Googling and tests in and find two ways to solve it. The first one is easy but kind of stupid, while the second one is superior but needs more coding.
theme: 'forest'
. Or add an option inconfig.toml
and let users decide.data-processed
property, which make mermaid thinks the DOM nodes are not processed. Then, render them with new parameters.Thank you for your time and this excellent theme!
The text was updated successfully, but these errors were encountered: