diff --git a/nimdoc/testproject/expected/testproject.html b/nimdoc/testproject/expected/testproject.html
index e45492dace..cba9391afe 100644
--- a/nimdoc/testproject/expected/testproject.html
+++ b/nimdoc/testproject/expected/testproject.html
@@ -22,49 +22,6 @@
-
-
diff --git a/nimdoc/testproject/expected/theindex.html b/nimdoc/testproject/expected/theindex.html
index 88d4b86aa7..47fae24915 100644
--- a/nimdoc/testproject/expected/theindex.html
+++ b/nimdoc/testproject/expected/theindex.html
@@ -22,49 +22,6 @@
-
-
diff --git a/tools/dochack/dochack.nim b/tools/dochack/dochack.nim
index 3a663808da..c7b8232efb 100644
--- a/tools/dochack/dochack.nim
+++ b/tools/dochack/dochack.nim
@@ -1,6 +1,39 @@
import dom
import fuzzysearch
+
+proc switchTheme(event: Event) =
+ if event.target.checked:
+ document.documentElement.setAttribute("data-theme", "dark")
+ window.localStorage.setItem("theme", "dark")
+ else:
+ document.documentElement.setAttribute("data-theme", "light")
+ window.localStorage.setItem("theme", "light")
+
+
+proc nimThemeSwitch(event: Event) {.exportC.} =
+ var pragmaDots = document.getElementsByClassName("pragmadots")
+ for i in 0..
0:
+ document.documentElement.setAttribute("data-theme", currentTheme);
+
+ if currentTheme == "dark" and toggleSwitch != nil:
+ toggleSwitch.checked = true
+
proc textContent(e: Element): cstring {.
importcpp: "#.textContent", nodecl.}
@@ -396,5 +429,6 @@ proc copyToClipboard*() {.exportc.} =
"""
.}
-
+
copyToClipboard()
+window.addEventListener("DOMContentLoaded", nimThemeSwitch)
\ No newline at end of file