UNPKG

@nexim/tailwind-material-colors

Version:

A Tailwind CSS plugin to automatically generate and apply Material Design 3 color palettes.

66 lines 2.2 kB
import { type MaterialThemePalettes, type MaterialThemePluginOptions } from './lib/type.js'; import type { Config, PluginAPI } from 'tailwindcss/plugin'; export type { MaterialThemePalettes, MaterialThemePluginOptions } from './lib/type.js'; /** * Generates light and dark material design 3 color palettes based on the provided colors and scheme. * * @param options - The options for generating the color palettes. * * @example * ```ts * import { materialThemeBuilder } from '@nexim/material-design-color-tailwind-plugin'; * * const options = { * primaryColor: '#6200EE', * }; * * const { lightColors, darkColors } = materialThemeBuilder(options); * * console.log(lightColors.primary); * ``` * * @returns An object containing light and dark color palettes. */ export declare function materialThemeBuilder(options: MaterialThemePluginOptions): MaterialThemePalettes; /** * Creates a Tailwind CSS plugin that implements Material Design 3 theming. * This plugin generates CSS variables for light and dark themes, and provides utility classes for state interactions. * * The plugin provides: * - CSS variables for all Material Design 3 colors * - Dark mode support via media query and .dark class * - State utility classes (.state-*, .stateHover-*, .stateActive-*) * - Automatic color palette generation based on input colors * * @example * ```ts * // tailwind-plugin/material-colors.mjs * import { materialThemeBuilderTailwindPlugin } from '@nexim/material-design-color-tailwind-plugin'; * * export default materialThemeBuilderTailwindPlugin({ * colors: { * primary: '#6200EE', * extraColors: { * success: { * hex: '#00FF00', * }, * }, * }, * }); * ``` * * * And then use it in your CSS: * ```css * // main.css * @import 'tailwindcss'; * * @plugin "./tailwind-plugin/material-colors.mjs"; * ``` * * @throws {Error} When options parameter is undefined */ export declare const materialThemeBuilderTailwindPlugin: (options: MaterialThemePluginOptions, configFunction?: (options?: MaterialThemePluginOptions) => Partial<Config>) => { handler: (api: PluginAPI) => void; }; //# sourceMappingURL=main.d.ts.map