Dark mode, explained
A website can follow the device setting using the prefers-color-scheme CSS feature, offer its own switch, or do both.
It takes more than flipping colours. Pure white text on pure black can feel harsh, shadows stop working, and logos and images may need dark versions.
Colour variables make it manageable. Each colour gets a named role, such as text or background, and the theme changes the value behind the name.
A common bug is a flash of the wrong theme while the page loads. A small script in the head that applies the saved choice before the page paints solves it.



