UNPKG

@awal-solution/tailwind-theming

Version:

<div align="left"> <h1>Tailwind theming</h1> <p>The <b>TailwindCSS Multi-Theming Plugin</b> is a utility for creating and managing multiple themes in your TailwindCSS-based projects. With this library, you can define, add, update, and remove themes dyn

65 lines (64 loc) 2.01 kB
import { TailwindExtension } from '../config'; import { AddThemeType, DefaultThemeName, MultiThemePluginOptions, ThemeManagerType } from '../types'; declare class ThemeManager { private default; private themes; constructor(); private deepMerge; /** * Validate theme name. * @param themeName - The theme name to validate */ private validateThemeName; /** * Find a theme by name. * @param themeName - The theme name to find */ private find; /** * Set default theme. * @param themeName - The theme name to set new default theme */ init({ themes, defaultTheme, utilities }: ThemeManagerType): void; /** * Set default theme. * @param themeName - The theme name to set new default theme */ defaultTheme(themeName: DefaultThemeName): void; /** * Set default theme. * @param utilities - utilities classes for tailwind css it will merge previous and new classes */ addUtilities(utilities: Record<string, any>): void; /** * Get available themes with their names and selectors. * @returns An object of available themes */ getThemeSelectors(): Record<string, { name: string; selectors?: string[]; }>; /** * Add a new theme. * @param theme - The theme to add */ add(theme: AddThemeType): void; /** * Update an existing theme. * @param themeName - The name of the theme to update * @param properties - The properties to update */ update(themeName: string, properties: Partial<TailwindExtension>): void; /** * Remove a theme by name. * @param themeName - The name of the theme to remove */ remove(themeName: DefaultThemeName): void; /** * Get all available themes. * @returns MultiThemePluginOptions containing the default theme and additional themes. */ get(): MultiThemePluginOptions; } declare const themeManager: ThemeManager; export { themeManager };