From aac2572b4e6c61226d3b5f8efa30ea95a13571c5 Mon Sep 17 00:00:00 2001 From: Ajay Date: Mon, 24 Jan 2022 23:38:44 -0500 Subject: [PATCH] Add live update for dark mode --- src/options.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/options.ts b/src/options.ts index 2b47fd4c..9f1f0cb2 100644 --- a/src/options.ts +++ b/src/options.ts @@ -126,6 +126,13 @@ async function init() { else document.getElementById("sbDonate").classList.remove("hidden"); break; + case "darkMode": + if (checkbox.checked) { + document.documentElement.setAttribute("data-theme", "dark"); + } else { + document.documentElement.setAttribute("data-theme", "light"); + } + break; } // If other options depend on this, hide/show them