jensmtg / obsidian-diagrams-net

This repository contains a plugin for Obsidian for inserting and editing diagrams.net (previously draw.io) diagrams.
MIT License
97 stars 14 forks source link

Requesting Dark Mode #5

Open Hunanbean opened 1 year ago

Hunanbean commented 1 year ago

If possible, please enable dark UI mode.

Thank you for enabling the use of Diagrams.net/draw.io in Obsidian for us.

Mat4m0 commented 1 year ago

+1 This would also be on top of my list.

Also, big thank you from my side

alterdaemon commented 1 year ago

To get Dark Theme just change the line 20494 in main.js to

const ui = "&ui=dark";

done

mrdotkg commented 1 year ago

@alterdaemon this worked, thanks! I tried const ui = "&ui=sketch";. Is it also possible to enable Dark Appearance on top of my selected Sketch Theme? Like the desktop app for draw.io.

Oberon-Zheng commented 1 year ago

To get Dark Theme just change the line 20494 in main.js to

const ui = "&ui=dark";

done

Thanks to @alterdaemon 's suggestion. It worked.

But I'd like to add a point: const ui = "&ui=dark"; indeed change the interface display into dark, however it does nothing with the exported svg embedded in the note or canvas.

To let the svg follow theme, additionally we need to focus on the save & export logic from line 20524, and add another line:

_postMessage({
        action: "export",
        format: "svg",
        embedImages: true,
        //add this line
        keepTheme: true,
        exit: false,
      }

This let the exportion always follows the display once you save.

The plugin actually runs as an embedded instance, so I referenced the doc of diagrams.net: https://www.drawio.com/doc/faq/embed-mode#description-of-the-json-protocol With this you can have more customizations.