@jay-js/system
Version:
A powerful and flexible TypeScript library for UI, state management, lazy loading, routing and managing draggable elements in modern web applications.
60 lines (59 loc) • 1.55 kB
TypeScript
import type { TThemeMode, TThemeModeResult } from "../types";
/**
* Initializes the theme system based on stored preferences or system settings.
*
* @example
* initTheme();
*/
export declare function initTheme(): void;
/**
* Gets the current theme and mode information.
*
* @returns {TThemeModeResult} Object containing the current theme name and mode
*
* @example
* const current = getCurrentTheme();
*
* @example
* const { theme, mode } = getCurrentTheme();
*/
export declare function getCurrentTheme(): TThemeModeResult;
/**
* Sets the current theme of the application.
*
* @param {string} theme - The theme name or ID to set
* @param {TThemeMode} [mode] - Optional mode to set (light or dark)
*
* @example
* setTheme('red');
*
* @example
* setTheme('my-unlisted-theme', 'dark');
*
* @example
* setTheme('custom-theme');
*/
export declare function setTheme(theme: string, mode?: TThemeMode): void;
/**
* Toggles between light and dark theme modes for the current theme.
*
* @returns {TThemeModeResult} Object containing the new theme name and mode
*
* @example
* const result = toggleThemeMode();
*
* @example
* const result = toggleThemeMode();
*/
export declare function toggleThemeMode(): TThemeModeResult;
/**
* Checks if the user's system prefers a dark color scheme.
*
* @returns {boolean} True if the system prefers dark mode, false otherwise
*
* @example
* if (prefersColorSchemeDark()) {
* console.log('Dark mode is enabled');
* }
*/
export declare function prefersColorSchemeDark(): boolean;