Add simple dark mode to http.server directory list and error pages

To make the directory lists and error pages of the simple HTTP server from http.server more readable in dark environments, a simple dark mode support using a few lines of CSS could enhance user experience. I propose the following CSS code, which uses white font on black background when requested by the browser:

<style type="text/css">
@media (prefers-color-scheme: dark) {
  body {
    background-color: #000;
    color: #fff;
  }
}
</style>

Hi Marvin, and welcome :slight_smile:

This was opened as issue #95812 and rejected by @storchaka on the basis that http.server does not include any color information and should not, and I agree.

For additional context, it looks like this request was first made in the third-party uploadserver project, whose maintainer suggested opening a Python bug.

2 Likes