Automatic Dark or Light Mode for SWI-Prolog

Just noticed that many new devices and new websites,
come with dark and light mode available. Plus a third option
to automatically switch between dark and light mode

depending on time of day, so called Auto Dark mode.
Can the SWI-Prolog console switch automatically, or
can SWISH switch automatically?

CSS is able to detect the current mode via:

@media (prefers-colour-scheme: dark) {
    body {
        colour: #ccc;
        background: #222;
    }
}

These are two completely independent problems. The IDE and console colouring can be controlled by loading library(theme/dark) or library(theme/auto). The latter assumes SWI-Prolog is started from an ansi compliant terminal that supports reporting the current color scheme. In theory this can/should be extended with OS specific ways to detect the current mode. Is there a way to detect the user preference on Windows/MacOS/Linux/…?

SWISH is just a website, so your @media should work. If anyone is willing to create a patch to support dark mode (next to the current mode), I’ll surely merge it.