From fc6ffc4c985bd0441bcfe0003bc258a5959a3625 Mon Sep 17 00:00:00 2001 From: Francisco Torres Date: Sat, 20 Dec 2025 23:34:16 -0400 Subject: [PATCH 1/2] Added support for full screen dark mode and no color flickering --- mkdocs_drawio/css/drawio-darkmode.css | 8 ++++++++ mkdocs_drawio/js/drawio-darkmode.js | 18 ++---------------- pyproject.toml | 2 +- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/mkdocs_drawio/css/drawio-darkmode.css b/mkdocs_drawio/css/drawio-darkmode.css index b80635e..a32023d 100644 --- a/mkdocs_drawio/css/drawio-darkmode.css +++ b/mkdocs_drawio/css/drawio-darkmode.css @@ -13,3 +13,11 @@ [data-bs-theme="dark"] { color-scheme: dark; } + +/* Override drawio's color-scheme + to just inherit from what was set + for the page in the code above */ +.mxgraph, +.geDiagramContainer { + color-scheme: inherit !important; +} \ No newline at end of file diff --git a/mkdocs_drawio/js/drawio-darkmode.js b/mkdocs_drawio/js/drawio-darkmode.js index d2884bb..c56935a 100644 --- a/mkdocs_drawio/js/drawio-darkmode.js +++ b/mkdocs_drawio/js/drawio-darkmode.js @@ -1,16 +1,2 @@ -const colorSchemeToggle = async function () { - document.querySelectorAll("div.mxgraph").forEach(function (div) { - let style = div.getAttribute("style").replace(/color-scheme: light;/gi, ""); - div.setAttribute("style", style); - }); -}; - -if (typeof document$ !== "undefined" && typeof document$.subscribe === "function") { - document$.subscribe(({ body }) => { - colorSchemeToggle(); - }); -} else { - document.addEventListener("DOMContentLoaded", function () { - colorSchemeToggle(); - }); -} +// Historical code no longer needed. +// Keeping file in case it is needed in the future. \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 1d9f102..e813544 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "mkdocs-drawio" -version = "1.12.1" +version = "1.12.2" description = "MkDocs plugin for embedding Drawio files" authors = [ "Jan Larwig ", From a5d5e0e5b93a424bb2025c2c3eb010fab4b77f49 Mon Sep 17 00:00:00 2001 From: Francisco Torres Date: Sun, 21 Dec 2025 09:48:55 -0400 Subject: [PATCH 2/2] Remove dar mode JS file and reference to it in plugin. --- mkdocs_drawio/js/drawio-darkmode.js | 2 -- mkdocs_drawio/plugin.py | 1 - 2 files changed, 3 deletions(-) delete mode 100644 mkdocs_drawio/js/drawio-darkmode.js diff --git a/mkdocs_drawio/js/drawio-darkmode.js b/mkdocs_drawio/js/drawio-darkmode.js deleted file mode 100644 index c56935a..0000000 --- a/mkdocs_drawio/js/drawio-darkmode.js +++ /dev/null @@ -1,2 +0,0 @@ -// Historical code no longer needed. -// Keeping file in case it is needed in the future. \ No newline at end of file diff --git a/mkdocs_drawio/plugin.py b/mkdocs_drawio/plugin.py index 80e2d46..6e99685 100644 --- a/mkdocs_drawio/plugin.py +++ b/mkdocs_drawio/plugin.py @@ -151,7 +151,6 @@ def on_config(self, config: base.Config): if self.config.darkmode: self.css.append("css/drawio-darkmode.css") - self.js.append("js/drawio-darkmode.js") for path in self.css: config.extra_css.append(str(path))