UNPKG

nhb-toolbox

Version:

A versatile collection of smart, efficient, and reusable utility functions and classes for everyday development needs.

26 lines 1.47 kB
import type { Percent } from '../number/types'; import type { ColorInputArray } from './types'; /** * * Generates a hex color based on the first character (initial) of a string or number. * * - For numbers, it uses 10 predefined colors (0-9). * - For letters, it uses 26 predefined colors (A-Z). * - Invalid characters handled with a fallback color. * @param input - A string or number. * @param opacity - A value from 0 to 100 representing the opacity percentage. * @returns A hex color for the first character of the provided string/number. */ export declare function getColorForInitial(input: string | number, opacity?: Percent): string; /** * * Generates an array of hex colors based on the first character (initial) of an array of strings/numbers or even nested arrays of strings/numbers. * * - For numbers, it uses 10 predefined colors (0-9). * - For letters, it uses 26 predefined colors (A-Z). * - For empty array it returns all 36 colors. * - Invalid characters and inputs are handled with a fallback color. * @param input - A string, number, or an array of strings/numbers or even nested arrays of strings/numbers. * @param opacity - A value from 0 to 100 representing the opacity percentage. * @returns A hex color for a string/number, or an array of hex colors for each element of the provided array. */ export declare function getColorForInitial(input: ColorInputArray, opacity?: Percent): string[]; //# sourceMappingURL=initials.d.ts.map