plain-site › night mode
This page has a dark mode, and it contains no colour at all. One line in the
<head> does it:
It tells the browser that the page is fine with either scheme. The browser then follows the
operating system: a dark background, light text, light links, and dark form controls and
scrollbars, all from the browser's own palette. The switch above only changes that
content attribute. It writes one HTML attribute and nothing else, and it remembers
your choice in localStorage.
A link ・ marked text ・ ・
・
Colours you set yourself do not adapt. A <font color="navy">
that is readable on white is invisible on the dark background, and a
bgcolor="#eeeeee" table row turns into a bright stripe under light text. So every
site makes one choice:
| System palette | Fixed palette | |
|---|---|---|
| How | <meta name="color-scheme" content="light dark">, no colour
attributes | bgcolor, text, <font color>; no
color-scheme meta |
| Dark mode | free, automatic | none, or a hand-written switch (below) |
| Colour you may use | links, <mark>, <meter>,
form controls (they adapt) | anything |
| Looks like | a document | a 1998 home page |
Here the meta tag says dark only, so the frame is dark whatever your system
says. Change it to light. Then add <font color="navy"> around
the text and switch back to see the trade-off.
If the site uses fixed colours, the night version is a second fixed palette, swapped with
document.bgColor and friends. Those properties write the
<body> attributes, so it is still all HTML. Each palette is one object.
<meta name="theme-color" content="#1d1f21"> tints the browser's toolbar
and address bar on Android, in Safari, and in installed web apps. It is one more colour that
needs no CSS.
▲ top ・ plain-site ・ previous: museum ・ next: probe