35 lines
1.2 KiB
HTML
35 lines
1.2 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="{{ site.LanguageCode }}">
|
|
{{ partial "head.html" . }}
|
|
|
|
<body class="not-ready" data-menu="{{ isset site.Menus `main` }}">
|
|
{{ partial "header.html" . }}
|
|
<main class="main">
|
|
{{ block "main" . }}{{ end }}
|
|
</main>
|
|
{{ partial "footer.html" . }}
|
|
</body>
|
|
|
|
{{ if and .IsPage .Params.is_p5js_sketch }}
|
|
<script src="{{ `scripts/p5-1.4.1.min.js` | absURL }}"></script>
|
|
<script src="{{ `scripts/sketch-utils.js` | absURL }}"></script>"
|
|
{{ with .Resources.GetMatch "sketch.js" }}
|
|
<script src="{{ .RelPermalink }}"></script>"
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
<script>
|
|
const bodyClasses = document.body.classList;
|
|
const systemDarkModeMatch = window.matchMedia('(prefers-color-scheme: dark)');
|
|
const localStorageDarkMode = localStorage.getItem('dark');
|
|
|
|
const setDark = isDark => {
|
|
bodyClasses[isDark ? 'add' : 'remove']('dark');
|
|
localStorage.setItem('dark', isDark ? 'yes' : 'no');
|
|
};
|
|
|
|
setDark(localStorageDarkMode ? localStorageDarkMode === 'yes' : systemDarkModeMatch.matches);
|
|
requestAnimationFrame(() => bodyClasses.remove('not-ready'));
|
|
systemDarkModeMatch.addEventListener('change', (event) => setDark(event.matches));
|
|
</script>
|
|
</html>
|