mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2025-04-29 03:53:30 +08:00
37 lines
1.6 KiB
HTML
37 lines
1.6 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="{{ .Site.LanguageCode }}">
|
|
<head>
|
|
{{- partial "head/head.html" . -}}
|
|
{{- block "head" . -}}{{ end }}
|
|
</head>
|
|
<body class="{{ block `body-class` . }}{{ end }}">
|
|
<script>
|
|
(function() {
|
|
const colorSchemeKey = 'StackColorScheme';
|
|
const colorSchemeItem = localStorage.getItem(colorSchemeKey);
|
|
const supportDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches === true;
|
|
|
|
if (colorSchemeItem && colorSchemeItem == 'dark' || !colorSchemeItem && supportDarkMode || colorSchemeItem === 'auto' && supportDarkMode) {
|
|
/**
|
|
* Enable dark mode if:
|
|
* 1. If dark mode is set already (in local storage)
|
|
* 2. No color scheme preference is set in localstorage, and user's browser indicates preference for dark mode
|
|
*/
|
|
document.body.dataset.scheme = 'dark';
|
|
} else {
|
|
document.body.dataset.scheme = 'light';
|
|
}
|
|
})();
|
|
</script>
|
|
|
|
<div class="container flex on-phone--column align-items--flex-start {{ if .Site.Params.widgets.enabled }}extended{{ else }}compact{{ end }} {{ block `container-class` . }}{{end}}">
|
|
{{ partial "sidebar/left.html" . }}
|
|
<main class="main full-width">
|
|
{{- block "main" . }}{{- end }}
|
|
</main>
|
|
{{- block "right-sidebar" . -}}{{ end }}
|
|
</div>
|
|
{{ partial "footer/include.html" . }}
|
|
</body>
|
|
</html>
|