Skip to content

Theme Provider

Overview

Theme manages the application color scheme (light, dark, or system) by setting data-pm-theme on the document root and persisting the preference in localStorage. All Paramanu components use light-dark() CSS function for automatic adaptation.

Usage

import { setTheme, getTheme } from "@paramanu/utilities-js"
setTheme("dark")
console.log(getTheme()) // "dark"

Guidelines

  • Wrap your app root with Theme for consistent theming
  • Use "system" as default to respect user OS preference
  • The useTheme hook provides read/write access to the current mode
  • Theme preference persists across page reloads via localStorage

API

PropTypeDefaultDescription
defaultMode"light" | "dark" | "system""system"Initial color scheme
storageKeystring"pm-theme"localStorage key for persistence