vanilla-theme
Version:
A small library to quickly add a light and dark mode functionality in you Vanilla JavaScript application
16 lines (15 loc) • 610 B
TypeScript
type Theme = "dark" | "light" | "system";
export declare function subscribe_to_theme_changes(subscriber: (theme: Theme) => void): () => void;
/** Changes the theme to either
*
* - `light`
* - `dark`
* - `system`
*
* If an invalid value is provided, defaults to the default you provide or "system".
*/
export declare function change_theme(theme: Theme): void;
export declare function set_storage(setStorage: "localStorage" | "sessionStorage"): void;
/** The default fallback if a value is neither dark, light, nor system. */
export declare function set_default(defaultTheme: Theme): void;
export {};