Skip to content

Add support for themes in mermaid#22

Open
Wiskerke wants to merge 2 commits intosilverbulletmd:mainfrom
Wiskerke:add_themes_support
Open

Add support for themes in mermaid#22
Wiskerke wants to merge 2 commits intosilverbulletmd:mainfrom
Wiskerke:add_themes_support

Conversation

@Wiskerke
Copy link
Copy Markdown

Hi,

This merge request mainly adds support for configuring themes, with improved support for darkmode. (I mainly use darkmode and the default experience with the silverbullet-mermaid plug is not great. And with these changes you can at least configure it with better alternatives.)

I've updated the readme.md (and the plug has the same copy pasted content) with the explanation of how the theming works.

In addition there are a couple of small refactorings / fixes:

  • Since config cannot be undefined (we are providing a default value to it), don't bother with the config?..
  • Moved the version default outside the getConfig, to make it more consistent with the rest of the code.
  • Switch from the deprecated 'mermaid.init' method to 'run'
  • The 'click' event is now doing an alternative action to refocus the editor, since 'api' is no longer working.

Also includes a small fix that the click event triggers a refocus of the
editor.
That was not supposed to be part of the pull request
@Wiskerke
Copy link
Copy Markdown
Author

I am wondering a bit if I'm not making it too big here. I like the whole package, but it does make this plug less suitable as an example plug.

@zefhemel : If you like I could create a pull request that only supports the 'theme' and 'theme_darkmode' from the settings. I think that is sort of the minimum to make it useful for darkmode.

I do like the fillBackground option, but that is the main feature that adds the complexity. As fillBackground is something that makes sense only to enable on some diagrams (and then you'd need frontmatter parsing), and then it is really nice to be able to configure the background color...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant