UNPKG

string-to-tailwind-color

Version:

Generates a random but deterministic Tailwind CSS color and shade from a string

11 lines (9 loc) 782 B
type TailwindColor = 'red' | 'orange' | 'amber' | 'yellow' | 'lime' | 'green' | 'emerald' | 'teal' | 'cyan' | 'sky' | 'blue' | 'indigo' | 'violet' | 'purple' | 'fuchsia' | 'pink' | 'rose' | 'slate' | 'gray' | 'zinc' | 'neutral' | 'stone'; type TailwindShade = 50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 950; interface StringToColorOptions<Color extends TailwindColor = TailwindColor, Shade extends TailwindShade = TailwindShade> { colors?: readonly Color[]; shades?: readonly Shade[]; hashOffset?: number; } export const stringToTailwindColor: <Color extends TailwindColor = TailwindColor, Shade extends TailwindShade = TailwindShade>(str: string, options?: StringToColorOptions<Color, Shade>) => `${Color}-${Shade}`; //# sourceMappingURL=main.d.ts.map