The current light or dark system theme, or null during SSR and in unsupported or inaccessible environments.
Unlike resolveThemePreference, this function does not inspect URL parameters or storage and does not provide a fallback theme. It performs a one-time read without mutating the DOM, applying a theme, writing storage, or adding media-query listeners. Use listenMediaQueryChanges when future changes must be observed.
Read the operating system's current color-scheme preference.
This performs one synchronous
(prefers-color-scheme: dark)media-query check. It returnsdarkwhen the query matches,lightwhen the query is available and does not match, ornullwhen the preference cannot be read safely.Usage:
Possible browser output: