I2P brand styleguides for the web
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.9 KiB

<head>
<meta charset="utf-8">
<title>{{site.title}}</title>
<link rel="stylesheet" href="{{'/assets/static/bootstrap.min.css' | prepend: site.baseurl}}">
<link rel="stylesheet" href="{{'/assets/styles/main.css' | prepend: site.baseurl}}">
<link rel="shortcut icon" type="image/png" href="{{'/assets/images/favicon.png' | prepend: site.baseurl}}"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<script> // Theme check on load
(function () {
var theme = window.localStorage.getItem("theme");
if (theme) {
document.documentElement.dataset.theme = theme;
}
}());
</script>
<script> // Detect media preference changes such as changing themes in browser/system
(function() {
var mqDark = window.matchMedia('(prefers-color-scheme: dark)');
var mqLight = window.matchMedia('(prefers-color-scheme: light)');
var theme = window.localStorage.getItem('theme');
function checkTheme(event) {
if (event.matches) {
if (event.media.includes('dark')) {
document.documentElement.dataset.theme = 'dark';
}
if (event.media.includes('light')) {
document.documentElement.dataset.theme = 'light';
}
}
}
if (!theme) {
try {
mqDark.addEventListener('change', checkTheme);
mqLight.addEventListener('change', checkTheme);
} catch (maybeSafari) {
try {
mqDark.addListener(checkTheme);
mqLight.addListener(checkTheme);
} catch (dontknow) {
// not supported…
}
}
}
}());
</script>