[PATCH v3] css: Support for dark mode

Samuel Lidén Borell samuel at kodafritt.se
Sun Jan 22 13:04:37 UTC 2023


On Sun, 22 Jan 2023 12:35:09 +0100, Samuel Lidén Borell <samuel at kodafritt.se> wrote:

> Modern browsers have a "dark mode" preference, which enables alternate
> styles on web sites that support this.
> 
> This patch adds a dark color scheme, that is automatically activated
> via a CSS @media query.
> 
> Older browsers that do not support color schemes will simply show the
> light scheme, but possibly without syntax highlighting.
> 
> Note that filters that use color (such as source highlighters) and
> logotypes may need to be updated to work with a black background!
> See the updated files in the filters/ directory.

Just a description of the changes from the previous version of the patch:

* Improved the dark color scheme
* Fixed white pixels around code blocks in markdown pages
* Fixed invisible text in formatters by wrapping even the light CSS in media queries. Unfortunately this disables highlighting on old browsers, which instead show black text.
* Fixed CSS for highlight 3
* Added "only all and" to the dark media query, so it gets ignored by (extremely) old browsers.

Tested on Firefox 102.7.0 ESR, Firefox 109, Chromium 109 and Netsurf 3.10. Netsurf is a browser that does not support color schemes, and defaults to the light theme. Firefox has a "resist fingerprinting" mode, in which it always uses the light theme.

Regards,
Samuel


More information about the CGit mailing list