Reduce flickering with dark/light theme (#1241)

This commit is contained in:
Dawid Potocki 2019-08-31 22:30:53 +00:00 committed by nitrohorse
parent 0276f52ed2
commit 24412dcf8f
4 changed files with 28 additions and 20 deletions

6
assets/js/applytheme.js Normal file
View file

@ -0,0 +1,6 @@
if (localStorage.getItem("colorScheme") === "dark") {
document.querySelector("#dark-css").removeAttribute("media"); // Set dark theme
}
else if (localStorage.getItem("colorScheme") === "light") {
document.querySelector("#dark-css").setAttribute("media", "invalid"); // Set light theme
}