prefers-color-scheme

noun

say it: “prih-FURZ KUL-er SKEEM” /prɪˈfɜːrz ˈkʌlər skiːm/

A CSS media feature that checks whether the person has set their device to a light or a dark theme, so a page can match it.

What does prefers-color-scheme do?

prefers-color-scheme checks whether the user has chosen a light or dark theme on their device.

@media (prefers-color-scheme: dark) {
  body { background: #121212; color: #eee; }
}

In a sentence

  • “With a prefers-color-scheme query, the playlist page turns dark at night when my phone does.”

Level: Journeyman · More CSS terms at this level

Updated