1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-21 05:01:16 -04:00

reduce theme context's unnecessary crap even more

This commit is contained in:
2022-04-08 18:15:06 -04:00
parent d09cf7ab26
commit 6f2018bd6e
5 changed files with 73 additions and 105 deletions

View File

@@ -15,12 +15,12 @@ const clientScript = () => {
l = document.documentElement.classList;
l.remove("__LIST_OF_CLASSES__");
if (!p || p === "system") {
if (p === "light" || p === "dark") {
l.add(c[p]);
} else {
var q = "__MEDIA_QUERY__",
m = window.matchMedia(q);
m.media !== q || m.matches ? l.add(c["dark"]) : l.add(c["light"]);
} else {
l.add(c[p]);
}
} catch (e) {}
};