On Mon, May 11, 2020 at 11:20:58AM +0200, Charlene Wendling wrote: > Hi, > > Similarly to what has been done for the OpenBSD project pages [0], this > diff adds a "dark mode" to directory listings and error pages in httpd, > using OpenBSD's dark color scheme. > > The goal is to avoid switching from a "dark mode" html page to a pure > white {directory listing,error} one, and this on the same site, > because it's very upsetting. > > This is how it looks like [1] in Firefox (Iridium is in light mode). > > I already had some comments and feedback from florian@ (error pages > need love too), clematis (correct background color), danj@ > (improve code readability) amongst others, but more is welcome :) > > Charlène. > > > [0] https://marc.info/?l=openbsd-cvs&m=155942699008642&w=2 > [1] http://0x0.st/i_yc.png > > > Index: usr.sbin/httpd/server_file.c > =================================================================== > RCS file: /cvs/src/usr.sbin/httpd/server_file.c,v > retrieving revision 1.66 > diff -u -p -r1.66 server_file.c > --- usr.sbin/httpd/server_file.c 15 Jun 2018 12:36:05 -0000 1.66 > +++ usr.sbin/httpd/server_file.c 10 May 2020 22:29:59 -0000 > @@ -477,7 +477,11 @@ server_file_index(struct httpd *env, str > > /* A CSS stylesheet allows minimal customization by the user */ > style = "body { background-color: white; color: black; font-family: " > - "sans-serif; }\nhr { border: 0; border-bottom: 1px dashed; }\n"; > + "sans-serif; }\nhr { border: 0; border-bottom: 1px dashed; }\n" > + "@media (prefers-color-scheme: dark) {\n" > + "body { background-color: #1e1f21; color: #EEEFF1; }\n"
please use uppercase here ^^^^^^^ > + "a { color: #BAD7FF; }\n}"; > + > /* Generate simple HTML index document */ > if (evbuffer_add_printf(evb, > "<!DOCTYPE html>\n" > Index: usr.sbin/httpd/server_http.c > =================================================================== > RCS file: /cvs/src/usr.sbin/httpd/server_http.c,v > retrieving revision 1.137 > diff -u -p -r1.137 server_http.c > --- usr.sbin/httpd/server_http.c 25 Feb 2020 15:18:41 -0000 1.137 > +++ usr.sbin/httpd/server_http.c 10 May 2020 22:30:00 -0000 > @@ -921,7 +921,10 @@ server_abort_http(struct client *clt, un > /* A CSS stylesheet allows minimal customization by the user */ > style = "body { background-color: white; color: black; font-family: " > "'Comic Sans MS', 'Chalkboard SE', 'Comic Neue', sans-serif; }\n" > - "hr { border: 0; border-bottom: 1px dashed; }\n"; > + "hr { border: 0; border-bottom: 1px dashed; }\n" > + "@media (prefers-color-scheme: dark) {\n" > + "body { background-color: #1e1f21; color: #EEEFF1; }\n" and here ^^^^^^^ with those fixed OK florian@ > + "a { color: #BAD7FF; }\n}"; > > /* Generate simple HTML error document */ > if ((bodylen = asprintf(&body, > -- I'm not entirely sure you are real.