feat: theme

This commit is contained in:
Barrett Ruth 2025-11-09 14:35:00 -05:00
parent 8df0766439
commit fb0229d80e
7 changed files with 89 additions and 13 deletions

View file

@ -1,5 +1,5 @@
<footer>
<span>ʕ •ᴥ•ʔ</span>
<span id="theme-toggle">ʕ•ᴥ•ʔつ☼</span>
<div class="footer-links">
<a href="/gist.html" data-topic="gist">gist</a>
<a href="/git.html" data-topic="git">git</a>
@ -20,6 +20,10 @@
align-items: center;
justify-content: space-between;
}
#theme-toggle {
cursor: pointer;
user-select: none;
}
.footer-links a {
margin-left: 25px;
text-decoration: none;

View file

@ -12,6 +12,17 @@ const {
<!doctype html>
<html lang="en">
<head>
<script is:inline>
(function () {
const stored = localStorage.getItem("theme");
const theme =
stored ||
(matchMedia("(prefers-color-scheme: dark)").matches
? "dark"
: "light");
document.documentElement.setAttribute("data-theme", theme);
})();
</script>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />