diff options
author | Daniel Friesel <derf@finalrewind.org> | 2021-05-26 21:45:02 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2021-05-26 21:45:02 +0200 |
commit | 26e25619eb23ac3c1e16d1f496655947917a2591 (patch) | |
tree | ea7773bbf2b6a2c78b9b28750d93a384a51b27c2 /share/html_detail_start | |
parent | 0e4badb22d7666d0db3737cb3a910437b5b0bf52 (diff) |
Revert "detail page: use average image color for background"
This reverts commit 0e4badb22d7666d0db3737cb3a910437b5b0bf52.
Diffstat (limited to 'share/html_detail_start')
-rw-r--r-- | share/html_detail_start | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/share/html_detail_start b/share/html_detail_start index de0b12b..2cd32ec 100644 --- a/share/html_detail_start +++ b/share/html_detail_start @@ -5,6 +5,30 @@ <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" type="text/css" href=".data/css/main.css"/> - <link rel="stylesheet" type="text/css" href=".data/css/<!-- $theme -->.css" id="theme"/> + <link rel="stylesheet" type="text/css" href=".data/css/light.css" id="theme"/> + <script> + function addStyleSheet(name, id) { + var path = '.data/css/' + name + '.css'; + var old = document.getElementById(id); + if (old && (old.href != path)) { + old.href = path; + } + } + var otherTheme = { + 'dark': 'light', + 'light': 'dark', + }; + var currentTheme = localStorage.getItem('theme'); + if (!otherTheme.hasOwnProperty(currentTheme)) { + currentTheme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'; + } + addStyleSheet(currentTheme, 'theme'); + + function toggleTheme() { + currentTheme = otherTheme[currentTheme] || 'light'; + localStorage.setItem('theme', currentTheme); + addStyleSheet(currentTheme, 'theme'); + } + </script> </head> <body> |