Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions Layout.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
interface Props {
title: string;
}

const { title } = Astro.props;
---

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
<meta name="generator" content={Astro.generator} />
<title>{title}</title>
</head>
<body>
<slot />
<script>
const theme = () => {
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
document.documentElement.dataset.theme = prefersDark ? 'dark' : 'light';
}

theme();

window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {
theme();
});
</script>
</body>
</html>

<style is:global>
:root {
--color-text: #24292e;
--color-background: #fff;
}

[data-theme="dark"] {
--color-text: #fff;
--color-background: #24292e;
}

html {
font-family: system-ui, sans-serif;
background-color: var(--color-background);
color: var(--color-text);
}

code {
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
}
</style>