mirror of
https://github.com/priyanshujain/margin.git
synced 2026-10-02 19:17:03 +00:00
feat(theme): persistent light/dark toggle in the titlebar
This commit is contained in:
1 parent
a5b3c0c0e3
commit
9991d318ba
5 files changed
+61
-3
No files matched your search
+10
@@ -4,6 +4,16 @@
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link rel="icon" type="image/png" href="/margin-mark.png" />
|
||||
<script>
|
||||
(function () {
|
||||
try {
|
||||
var t = localStorage.getItem("margin-theme");
|
||||
if (t !== "light" && t !== "dark")
|
||||
t = matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
||||
document.documentElement.setAttribute("data-theme", t);
|
||||
} catch (e) {}
|
||||
})();
|
||||
</script>
|
||||
<title>margin</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
Reference in new issue
Block a user