Tweakr
    Preparing search index...

    Function getThemePreference

    • Detects the user's preferred color scheme.

      Uses the prefers-color-scheme media query to determine if the user prefers a light or dark theme.

      Returns "light" | "dark"

      "light" if the user prefers a light theme, "dark" if dark.

      const theme = getThemePreference();
      console.log(theme); // "light" or "dark"

      1.1.0