lightmode flashing fix

main
Mark MacKay 2021-06-15 20:38:30 -05:00
parent e9b482e561
commit 69839f2a19
2 changed files with 2 additions and 1 deletions

View File

@ -5,6 +5,7 @@ MD.Darkmode = function(){
if (!button) return false;
function set(isDark) {
button.setAttribute("title", isDark ? "Switch to lightmode" : "Switch to darkmode")
body.classList.toggle("inverted", !isDark);
body.classList.add("cancel-transitions");

View File

@ -1,7 +1,7 @@
(function(){
const canvasContent = localStorage.getItem("md-canvasContent");
const isDark = localStorage.getItem("md-darkmode");
document.body.classList.toggle("inverted", !isDark);
if (!isDark) body.classList.add("inverted");
if (!canvasContent) return;
const parser = new DOMParser();
const doc = parser.parseFromString(canvasContent, "image/svg+xml");