mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-04-26 09:05:22 -04:00
fix theme preference restoring
This commit is contained in:
parent
b13c8259b3
commit
a3a854b4ac
@ -14,7 +14,7 @@ export const clientScript = () => {
|
|||||||
|
|
||||||
// restore the local storage preference if it's set, otherwise test CSS media query for browser dark mode preference
|
// restore the local storage preference if it's set, otherwise test CSS media query for browser dark mode preference
|
||||||
// https://stackoverflow.com/a/57795495/1438024
|
// https://stackoverflow.com/a/57795495/1438024
|
||||||
const newTheme = (pref && pref === "dark") || window.matchMedia("__MEDIA_QUERY__").matches ? 1 : 0;
|
const newTheme = (pref && pref === "dark") ?? window.matchMedia("__MEDIA_QUERY__").matches ? 1 : 0;
|
||||||
|
|
||||||
// remove both `classNames` to start fresh...
|
// remove both `classNames` to start fresh...
|
||||||
classList.remove(classNames[0], classNames[1]);
|
classList.remove(classNames[0], classNames[1]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user