The
prefers-color-scheme
CSS media feature is used to detect if a user has requested light or dark color themes. A user indicates their preference through an operating system setting (e.g. light or dark mode) or a user agent setting.
@media (prefers-color-scheme: light) {}
@media (prefers-color-scheme: dark) {}