44 lines
1.1 KiB
Text
44 lines
1.1 KiB
Text
---
|
|
import "~/styles/globals.css"
|
|
import { NoiseBackground } from "~/components/react/noise-background"
|
|
import { ClientRouter } from "astro:transitions"
|
|
import { getLangFromUrl } from "~/i18n/utils"
|
|
import Head from "~/components/astro/head/root.astro"
|
|
|
|
const lang = getLangFromUrl(Astro.url)
|
|
---
|
|
|
|
<!doctype html>
|
|
<html lang={lang}>
|
|
<head>
|
|
<Head />
|
|
<ClientRouter />
|
|
<script is:inline>
|
|
const setTheme = () => {
|
|
const theme =
|
|
localStorage.getItem("theme") ??
|
|
(window.matchMedia("(prefers-color-scheme: dark)").matches
|
|
? "dark"
|
|
: "light")
|
|
|
|
if (theme === "dark") {
|
|
document.documentElement.classList.add("dark")
|
|
} else {
|
|
document.documentElement.classList.remove("dark")
|
|
}
|
|
}
|
|
|
|
setTheme()
|
|
|
|
document.addEventListener("astro:page-load", () => {
|
|
setTheme()
|
|
})
|
|
</script>
|
|
</head>
|
|
<body class="dark:bg-[#121212] dark:text-white">
|
|
<div class="flex min-h-screen w-full justify-center px-6 md:p-0">
|
|
<slot />
|
|
<NoiseBackground />
|
|
</div>
|
|
</body>
|
|
</html>
|