New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adjustment in Mermaid ERD Colors to improve Readability in Dark Mode #4975
Comments
Thanks for reporting! You're invited to open a PR for this. Please make sure that all other diagram types still work, i.e., don't have any unintended side effects – just check the diagrams documentation for that. |
On another note: we could certainly make diagrams more configurable by adding more CSS variables that target specific properties of elements. If you're interested in crafting a PR for that for discussion, this is definitely something to be considered for merging. We might need a few loops to iterate towards a good solution, but I think it could be a great addition to the project, making Mermaid.js customization easier. |
Thanks for getting back! I'll open a PR soon (hopefully even today). Should I also update the example diagrams, so that more cases (like the one I reported) become visible? Or would you like to keep that separate? In terms of exposing more CSS variables: Sounds interesting to try, but I don't want to promise anything I can't keep. If I find time, I might give it a shot sometime. But I also don't want to claim the task and block someone else who might be quicker at implementing it. |
That would be perfect! We should try to have as many specimen as possible in the example diagams while keeping them short, so try to strive a balance.
Don't worry, otherwise I'll tackle this some time later. |
@squidfunk I don't mean to rush you, just in case you didn't get notified: The PR (which turned out rather small) is ready for review: #4984 |
I did get notified, I'll look into it asap. |
Fixed in f759841. |
Released as part of 9.0.12. |
Thanks for fixing it, I'm looking forward to using it with the fixed colors :) |
Context
No response
Description
Currently, mermaid entity relationship diagrams look good in dark mode, if the entities do not contain any attribute definitions, as in the example here.
When defining attributes, it still looks readable in light mode, but in dark mode it is not readable at all. See the visuals for illustration.
As it turns out, to change the CSS behavior of mermaid diagrams like this, a custom theme needs to be created, which is not as convenient as most users would like to have it.
I found that the issue at hand can be found here:
mkdocs-material/src/assets/stylesheets/main/integrations/_mermaid.scss
Line 33 in e496f77
Here, a foreground color is applied to a background item, which is not surprising to cause some issues.
Changing the line to
--md-mermaid-node-bg-color: var(--md-default-bg-color);
changed the coloring to be in line with how other mermaid elements are rendered, and is much more readable (again, see visuals).Arguably, a solution with two shades of color alternating would correspond better with the official mermaid rendering, but I think even the simple, proposed solution would be an improvement.
If this change is approved, I'd be happy to open a PR from my fork, or see this incorporated in any other way.
Related links
Use Cases
This wouldn't introduce drastic change, some ER diagrams would just suddenly be more readable in dark mode.
Visuals
status quo
currently, in light mode, all looks ok:
but in dark mode it's not really readable
proposed change
Before submitting
The text was updated successfully, but these errors were encountered: