UNPKG

svelte-os-themes

Version:

[![Live Demo](https://img.shields.io/badge/Live%20Demo-Open-0ea5e9)](https://svelte-os-themes.vercel.app)

40 lines (39 loc) 1.22 kB
import type { Theme } from './types.js'; export interface CreateThemeOptions { /** * @description The fallback theme to use when no theme is set in localStorage. * @default 'system' */ fallback?: Theme; /** * @description The attribute used to set the theme on the `<html>` element. * @default 'class' */ attribute?: 'class' | `data-${string}`; /** * @description The key used to store the theme in localStorage. * @default 'theme' */ storageKey?: string; /** * @description Whether to listen for changes in the OS theme. * @default false */ system?: boolean; /** * @description Whether to set the `color-scheme` CSS property on the `<html>` element. * @default true */ colorScheme?: boolean; nonce?: string; } export interface CreateThemeReturn { get current(): Theme; set current(value: Theme | null | undefined); } export declare function createTheme(options: CreateThemeOptions | (() => CreateThemeOptions)): CreateThemeReturn; export declare namespace createTheme { var script: (props: CreateThemeOptions | (() => CreateThemeOptions)) => { readonly current: string; }; }