]> git.wh0rd.org - chrome-ext/web-power-switch.git/blobdiff - theme-init.js
add dark/light themes
[chrome-ext/web-power-switch.git] / theme-init.js
diff --git a/theme-init.js b/theme-init.js
new file mode 100644 (file)
index 0000000..8e80673
--- /dev/null
@@ -0,0 +1,9 @@
+// Written by Mike Frysinger <vapier@gmail.com>.  Released into the public domain.
+
+// Load the theme override asap to help with initial loading/flashing.
+chrome.storage.sync.get(['theme'], ({theme}) => {
+       if (theme == 'light' || theme == 'dark') {
+               const css = document.querySelector('link#theme-override');
+               css.href = `css/${theme}.css`;
+       }
+});