diff options
Diffstat (limited to 'share/html_detail_start')
-rw-r--r-- | share/html_detail_start | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/share/html_detail_start b/share/html_detail_start new file mode 100644 index 0000000..2cd32ec --- /dev/null +++ b/share/html_detail_start @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<html> +<head> + <title><!-- $title --></title> + <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/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> |