diff options
author | Daniel Friesel <derf@finalrewind.org> | 2021-08-21 11:08:40 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2021-08-21 11:08:40 +0200 |
commit | 73cbb842a4815a36e03d9e0c7243effd568c7bfd (patch) | |
tree | 0f02c939b17aee8e0fab5eb8e5daa6bb7683b2e2 /templates | |
parent | 6f1069470dac198edd3606d9e592312baaccd131 (diff) |
add proper dark mode support0.1.0
Diffstat (limited to 'templates')
-rw-r--r-- | templates/header.html | 12 | ||||
-rw-r--r-- | templates/navbar.html | 3 |
2 files changed, 12 insertions, 3 deletions
diff --git a/templates/header.html b/templates/header.html index b7260a5..1bf6219 100644 --- a/templates/header.html +++ b/templates/header.html @@ -11,3 +11,15 @@ <link rel="apple-touch-icon" sizes="152x152" href="/static/icons/icon-152x152.png"> <link rel="apple-touch-icon" sizes="167x167" href="/static/icons/icon-167x167.png"> <link href="/static/v0/css/light.min.css" id="theme" rel="stylesheet"> + +<script> + function addStyleSheet(name, id) { + const path = "/static/v0/css/" + name + ".min.css"; + const old = document.getElementById(id); + if (old && (old.href != path)) { + old.href = path; + } + } + const currentTheme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'; + addStyleSheet(currentTheme, 'theme'); +</script> diff --git a/templates/navbar.html b/templates/navbar.html index da217a9..2fc49ec 100644 --- a/templates/navbar.html +++ b/templates/navbar.html @@ -7,9 +7,6 @@ <span class="main">{{ title }}</span> {% endif %} <ul id="nav-mobile" style="float: right;"> - <li class="waves-effect waves-light"> - <a onClick="javascript:toggleTheme()"><i class="material-icons" aria-label="Farbschema invertieren">invert_colors</i></a> - </li> <li><a href="/"><i class="material-icons" aria-label="Stationen in der Umgebung suchen">my_location</i></a></li> </ul> </div> |