[BS5] add darkmode

This commit is contained in:
FreddleSpl0it
2022-06-28 07:20:46 +02:00
parent 2d0ab4a1b8
commit 9d3a89d362
3 changed files with 169 additions and 18 deletions

View File

@@ -9,6 +9,20 @@
<title>{{ ui_texts.title_name|raw }}</title>
<link rel="stylesheet" href="{{ css_path }}">
<script>
// check if darkmode is preferred by OS or set by localStorage
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ||
JSON.parse(localStorage.getItem("darkmode")) === true) {
var head = document.getElementsByTagName('head')[0];
var link = document.createElement('link');
link.id = 'dark-mode-theme';
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = '/css/themes/mailcow-darkmode.css';
head.appendChild(link);
}
</script>
<link rel="shortcut icon" href="/favicon.png" type="image/png">
<link rel="icon" href="/favicon.png" type="image/png">
</head>