UNPKG

gradient-generator-ui

Version:

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

41 lines (40 loc) 1.44 kB
import { colorPos } from '../Types'; import { GeneratorManager, ManagerOptions } from './Manager'; export declare class GradientGenerator { private UI; private mainElement; private colors; constructor({ mainElement, initialColors, }: { mainElement?: HTMLElement; initialColors?: colorPos[]; }); /** * Get the HTML Main Element */ getMainElement(): HTMLElement; /** * Get the list of colors with their respective proportional position */ getGradientColors(): colorPos[]; /** * Update the current list of colors * @param colors List of colors with their respective proportional position */ setGradientColors(colors: colorPos[]): void; /** * Add a new color to the current list of colors and create a new color control in the UI * @param color A single colors with their respective proportional position * @param indx Optional position to append in the GradientGenerator */ addColors(...newColors: colorPos[]): void; /** * Generates an array of colors in hexadecimal with the current colors and the number of expected colors * @param size Expected number of colors generated */ generateColors(size?: number): string[]; /** * Generate a manager with the current GradientGenerator * @param options Manager options */ createUIManager(options: ManagerOptions): GeneratorManager; }