feat(website): add a persistent light and dark theme switch

This commit is contained in:
N0zoM1z0
2026-10-13 09:27:49 +08:00
committed by Ysopwnable
parent eeba61826c
commit 4773c152bc
47 changed files with 31691 additions and 31305 deletions
+9
View File
@@ -8,6 +8,15 @@
<nav class="navigation" aria-label="Main navigation">$navigation</nav>
<div class="header-social">
$language_picker
<button class="theme-toggle" type="button" data-theme-toggle hidden>
<svg class="theme-moon" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
<path d="M20.9 13a9 9 0 0 1-9.9-9.9A9 9 0 1 0 20.9 13Z" />
</svg>
<svg class="theme-sun" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true" focusable="false">
<circle cx="12" cy="12" r="4" />
<path d="M12 2v2m0 16v2M2 12h2m16 0h2M4.93 4.93l1.42 1.42m11.3 11.3 1.42 1.42M4.93 19.07l1.42-1.42m11.3-11.3 1.42-1.42" />
</svg>
</button>
<a
class="nav-github"
href="https://github.com/morluto/rea"
+2 -10
View File
@@ -8,16 +8,8 @@
<meta name="robots" content="noindex" />
<!-- website:sharing:start -->
<!-- website:sharing:end -->
<meta
name="theme-color"
content="#ffffff"
media="(prefers-color-scheme: light)"
/>
<meta
name="theme-color"
content="#1e1e2e"
media="(prefers-color-scheme: dark)"
/>
<!-- website:theme:start -->
<!-- website:theme:end -->
<link rel="icon" href="${base}assets/favicon.svg" type="image/svg+xml" />
<link rel="stylesheet" href="${base}assets/styles.css" />
<script src="${base}assets/main.js" defer></script>
+3
View File
@@ -0,0 +1,3 @@
<meta name="theme-color" content="#ffffff" />
<!-- Apply the saved theme before styles load, to avoid a flash on navigation. -->
<script src="${base}assets/theme.js"></script>