vira - v33.8.0
    Preparing search index...

    Class ViraThemeClient

    Tracks the user's ViraThemeSelection and bridges it to a consumer-supplied applyTheme callback. Persists the selection through storage (LocalStorage by default), and listens for system color-scheme changes to re-apply the theme in auto mode without persisting. Listen for ViraThemeAppliedEvent to react to the displayed theme changing.

    The initial theme is applied during construction.

    Hierarchy

    Index
    appliedTheme: Light | Dark | undefined

    The theme that is currently displayed.

    applyThemeCallback: ApplyThemeCallback = defaultApplyThemeCallback

    The callback that will be called to apply a new theme.

    localStorageClient:
        | LocalStorageClient<
            {
                selectedTheme: Shape<
                    {
                        theme: Shape<
                            TUnion<(TLiteral<Light> | TLiteral<Dark> | TLiteral<Auto>)[]>,
                        >;
                    },
                >;
            },
        >
        | undefined

    The default storage, only created when no storage param is given.

    removeThemePreferenceListener: () => void = ...

    A callback to remove the global theme preference listener.

    selectedTheme: ViraThemeSelection

    The user's selected theme.

    Persists the user's selected theme.