UNPKG

@better-auth-ui/core

Version:

Authentication components and data utilities for [Better Auth](https://better-auth.com), available for React and Solid.

34 lines (31 loc) 866 B
import { createAuthPlugin } from "../../lib/create-auth-plugin" import { type ThemeLocalization, themeLocalization } from "./theme-localization" export type ThemePluginOptions = { /** * Override the plugin's default localization strings. * @remarks `ThemeLocalization` */ localization?: Partial<ThemeLocalization> /** * Initial theme value */ theme?: string /** * Function to set the theme. */ setTheme: (theme: string) => void /** * Available theme options * @default ["system", "light", "dark"] */ themes?: string[] } export const themePlugin = createAuthPlugin( "theme", (options: ThemePluginOptions) => ({ localization: { ...themeLocalization, ...options.localization }, theme: options.theme ?? "system", setTheme: options.setTheme, themes: options.themes ?? ["system", "light", "dark"] }) )