landmaj / mkdocs-d2-plugin

A plugin for embedding D2 diagrams in MkDocs.
https://landmaj.github.io/mkdocs-d2-plugin/
MIT License
16 stars 3 forks source link

Light/Dark palette switching with mkdocs's palette toggle #17

Open tylernguyen opened 1 month ago

tylernguyen commented 1 month ago

Hello,

Currently, d2 only switches the theme in accordance with system/browser preference.

Is there a way to sync the theme with mkdocs's current palette instead?

Minimal reproduction for test:

9.5.25+insiders.4.53.11-d2-does-not-respect-mkdocs-palette-toggle.zip

P.S. Basic function works great! Thank you for your work on this plugin.

landmaj commented 2 weeks ago

There is no way to sync the theme between D2 diagrams and MkDocs right now. It should be possible but I doubt it's as easy as it looks like since I embed SVG directly, otherwise links would not work. I'll give it a try when I have some free time.

Sorry for the late reply, I was on vacation.