luci-base: apply Browser/OS dark mode preference to index redirect page
authorJo-Philipp Wich <jo@mein.io>
Fri, 12 Nov 2021 09:37:49 +0000 (10:37 +0100)
committerJo-Philipp Wich <jo@mein.io>
Tue, 16 Nov 2021 12:06:03 +0000 (13:06 +0100)
Turn white body, black link into black body, white link if the Browser/OS
indicates dark mode preference.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-base/root/www/index.html

index 35c0ea0d32e3c208f838e5b9d962ac6542aa6de0..bc3c98fe71f01a48946ad8a7b9402f74e771f0b2 100644 (file)
@@ -1,11 +1,20 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
-<meta http-equiv="refresh" content="0; URL=cgi-bin/luci/" />
-</head>
-<body style="background-color: white">
-<a style="color: black; font-family: arial, helvetica, sans-serif;" href="cgi-bin/luci/">LuCI - Lua Configuration Interface</a>
-</body>
+       <head>
+               <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+               <meta http-equiv="refresh" content="0; URL=cgi-bin/luci/" />
+               <style type="text/css">
+                       body { background: white; font-family: arial, helvetica, sans-serif; }
+                       a { color: black; }
+
+                       @media (prefers-color-scheme: dark) {
+                               body { background: black; }
+                               a { color: white; }
+                       }
+               </style>
+       </head>
+       <body>
+               <a href="cgi-bin/luci/">LuCI - Lua Configuration Interface</a>
+       </body>
 </html>