From 28908e4d4ad38369dad3faf8be2e09fc115181b6 Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Sat, 8 Jun 2024 17:27:56 +0000 Subject: [PATCH] [dirlisting] Add dark mode support This adds dark mode support to lighttpd's dirlisting generated pages. Nowadays files transferred to browser via text/* MIME are also getting automatic dark mode by the browsers so this makes lighttpd's dirlisting compatible with those features of the browsers. --- src/modules/mod_dirlist.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/modules/mod_dirlist.c b/src/modules/mod_dirlist.c index 2a99e6bc..10b5bb65 100644 --- a/src/modules/mod_dirlist.c +++ b/src/modules/mod_dirlist.c @@ -80,7 +80,15 @@ static const gchar html_css[] = " div#footer { font: 90% monospace; color: #787878; padding-top: 4px; }\n" " a.sortheader { color: black; text-decoration: none; display: block; }\n" " span.sortarrow { text-decoration: none; }\n" - "\n"; + " @media (prefers-color-scheme: dark) {\n" + " a, a:active { color: #9E9EFF; }\n" + " a:visited { color: #D0ADF0; }\n" + " body, #dirlist { background-color: transparent; }\n" + " div#footer { color: #878787; }\n" + " a.sortheader { color: white; }\n" + " }\n" + "\n" + "\n"; static const gchar javascript_sort[] = "