/** * Canonical theme utilities for Raaghu Design System. * Single source for DOM theme state — used by RaaghuThemeProvider, * Storybook, chart-utils, and client applications. */ import { type RdsBrandOverrides } from '../../tokens/build-rds-css-vars'; /** * Supported theme modes for the Raaghu Design System. * * - `'light'` — always light, ignores OS preference * - `'dark'` — always dark, ignores OS preference * - `'system'` — follows the OS/browser `prefers-color-scheme` automatically */ export type RaaghuThemeMode = 'light' | 'dark' | 'system'; /** * Reads OS dark-mode preference. Checks parent/top windows so embedded * contexts (e.g. Storybook preview iframes) inherit the host preference. */ export declare function prefersDarkColorScheme(): boolean; /** * Resolves `'system'` to the actual effective mode by reading * `prefers-color-scheme`. `'light'` and `'dark'` are returned as-is. */ export declare function resolveEffectiveMode(mode: RaaghuThemeMode): 'light' | 'dark'; export interface ApplyRaaghuThemeOptions { /** When false, skips writing to localStorage (useful in Storybook). */ persist?: boolean; } export { type RdsBrandOverrides }; export declare const THEME_STORAGE_KEY = "raaghu-theme"; /** * Returns true when the document is in dark mode. * Checks data-theme and legacy body/html class patterns. */ export declare function isDarkMode(): boolean; /** * Applies theme to the DOM so runtime --rds-* tokens and MUI stay in sync. * * @param mode - `'light'`, `'dark'`, or `'system'` (follows OS preference). * @param overrides - Optional brand overrides applied on top of the base token set. */ export declare function applyRaaghuTheme(mode: RaaghuThemeMode, overrides?: RdsBrandOverrides, options?: ApplyRaaghuThemeOptions): void; /** * Reads Storybook toolbar theme from the URL hierarchy. * * The manager (parent) URL is the source of truth. Selecting the default * "System" theme clears `theme` from the manager query string, but the * preview iframe often keeps a stale `theme:light` / `theme:dark`. Prefer * the outermost accessible frame; if it has no explicit theme, treat as * system and ignore nested iframe globals. */ export declare function getStorybookThemeFromUrl(win?: Window): RaaghuThemeMode | null; export declare function getRaaghuThemeMode(): RaaghuThemeMode; /** * Initializes theme from localStorage or system preference. * Returns `'system'` when no stored preference exists (default behaviour). */ export declare function initializeRaaghuTheme(): RaaghuThemeMode;