mazey
    Preparing search index...

    Function getSystemTheme

    • Read the operating system's current color-scheme preference.

      This performs one synchronous (prefers-color-scheme: dark) media-query check. It returns dark when the query matches, light when the query is available and does not match, or null when the preference cannot be read safely.

      Usage:

      import { getSystemTheme } from "mazey";

      const systemTheme = getSystemTheme();

      console.log(systemTheme);

      Possible browser output:

      dark
      

      Returns ResolvedTheme | null

      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.