light-dark(): Dua Tema, Satu Baris Playground

The workshop’s sales card as a reversible cloth: write light-dark(), switch the OS and the theme button, the browser shows which argument it picked, and Mr…

Why it matters

Dark mode is standard now, but the old way (@media (prefers-color-scheme: dark)) writes every colour twice in two places: easy to forget one. light-dark() puts both in one declaration, and since it follows color-scheme, your site’s theme button only has to change one property. For old browsers, one fallback line above it.

The key idea

light-dark() picks an argument by color-scheme, not by the OS, and never blends

Common mistakes

Try it in this playground