UNPKG

gradient-generator-ui

Version:

Library to create a gradient generator in vanilla-js with interactive user interface in html

34 lines (33 loc) 1.41 kB
import { colorPos, colorRGB } from './Types'; /** * Normalize the hexadecimal color Separate the head (#) and transform 3digits to 6 * @param hex String of Color in hexadecimal format */ export declare function normalizeHex(hex: string): string; /** * Transform an color string in hexadecimal to a rgb object * @param hex String of Color in hexadecimal format */ export declare function hexToRGb(hex: string): colorRGB; /** * Transform an rgb object to a color string in hexadecimal * @param rgb object that represents a color in RGB */ export declare function rgbToHex(rgb: colorRGB): string; /** * Calculate the intermediate color between two colors * @param hex1 String of first Color in hexadecimal format * @param hex2 String of second Color in hexadecimal format */ export declare function getIntermediateColor(hex1: string, hex2: string): string; /** * Get a correct text color according to the contrast * @param hex String of the base Color in hexadecimal format */ export declare function getCorrectTextColor(hex: string): string; /** * Generates an array of colors in hexadecimal format based on the base color list and the number of expected colors * @param gradientColors List of colors with their respective proportional position * @param size Expected number of colors generated */ export declare function createGradient(gradientColors: colorPos[], size?: number): string[];