UNPKG

tailwind-theme-preset

Version:

A Tailwind CSS plugin for unified theme management with automatic CSS variable generation, supporting multi-theme configurations and Shadcn/ui compatibility.

38 lines (37 loc) 1.26 kB
//#region src/index.d.ts type ColorValue = string | [string] | [string, 'rgb' | 'hsl' | ((prefixKey: string, value: string) => string) | undefined]; interface RecursiveRecord { DEFAULT?: ColorValue; dark?: string; [key: string]: string | ColorValue | RecursiveRecord | undefined; } interface Theme { [key: string]: RecursiveRecord; } interface ThemeVar { ':root': Record<string, string>; [key: string]: Record<string, string>; } type DeepPartial<T> = { [P in keyof T]?: T[P] extends ((...args: any[]) => any) ? T[P] : T[P] extends object ? DeepPartial<T[P]> : T[P] }; interface Options { colorRule?: 'rgb' | 'hsl'; safelist?: string[]; } declare function presetTheme(theme: DeepPartial<Theme>, options: Options): { safelist: string[]; theme: { extend: { colors: Theme; }; }; plugins: (({ addUtilities }: { addUtilities: (utilities: Record<string, any>) => void; }) => void)[]; }; declare function generateColors(theme: Theme, options?: Options): Theme; declare function processTheme(theme: Theme): ThemeVar; declare function flatten(theme: Theme): Record<string, string>; //#endregion export { ColorValue, DeepPartial, RecursiveRecord, Theme, ThemeVar, flatten, generateColors, presetTheme, processTheme };