theme fix
This commit is contained in:
parent
7bc12d98d0
commit
bb82e46822
1 changed files with 18 additions and 0 deletions
|
|
@ -4,6 +4,24 @@
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<meta name="csrf-token" content={get_csrf_token()} />
|
<meta name="csrf-token" content={get_csrf_token()} />
|
||||||
|
<script>
|
||||||
|
(function() {
|
||||||
|
try {
|
||||||
|
var theme = (typeof localStorage !== 'undefined' && localStorage.getItem('theme')) || 'auto';
|
||||||
|
if(theme === 'auto') {
|
||||||
|
if(window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
||||||
|
document.documentElement.setAttribute('data-theme', 'dark');
|
||||||
|
} else {
|
||||||
|
document.documentElement.setAttribute('data-theme', 'light');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
document.documentElement.setAttribute('data-theme', theme);
|
||||||
|
}
|
||||||
|
} catch(e) {
|
||||||
|
document.documentElement.setAttribute('data-theme', 'light');
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
<.live_title suffix=" · aprs.me">
|
<.live_title suffix=" · aprs.me">
|
||||||
{assigns[:page_title] || "Aprs"}
|
{assigns[:page_title] || "Aprs"}
|
||||||
</.live_title>
|
</.live_title>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue