UNPKG

string-to-color-gradient

Version:

A lightweight npm library to convert any string into consistent hex colors and CSS gradients — perfect for avatars, tags, themes, blog cards, and visual identifiers. Turn names, emails, or any string into beautiful, deterministic color values that stay th

24 lines (23 loc) 636 B
/** * The brightness level to influence color saturation and lightness. * * - 'dark' => deeper colors * - 'normal' => balanced tones (default) * - 'light' => lighter, more pastel-like colors */ export type Brightness = 'dark' | 'normal' | 'light'; /** * Options to customize the gradient generation. */ export interface GradientOptions { /** * Brightness level used to determine color saturation/lightness. * @default 'normal' */ brightness?: Brightness; /** * Gradient angle in degrees or 'auto' to derive it from the string hash. * @default 'auto' */ angle?: 'auto' | number; }