UNPKG

gradient-generator-ui

Version:

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

50 lines (49 loc) 1.42 kB
import { colorPos } from '../Types'; export declare class ColorControl { private mainElement; private deleteEl; private positionEl; private valueEl; constructor(color: colorPos); /** * Get the main element for this control */ get Element(): HTMLElement; /** * Get the color selected in hexadecimal format */ get ColorHex(): string; /** * Get the proportional position of this control */ get Position(): number; /** * Update the position of the delete and value inputs */ private changePosition; /** * Change the background color with respect the value input */ private changeBg; /** * Add an event listener when delete element * @param cb Callback */ onDelete(cb: (ev: MouseEvent) => void): void; /** * Add an event listener when the control change it position * @param cb Callback */ onPositionChange(cb: (ev: Event) => void): void; /** * Add an event listener when the control change it color value * @param cb Callback */ onColorChange(cb: (ev: Event) => void): void; /** * Assign the proportional position limits of this color control * @param minlimit lower limit of the position input * @param maxlimit upper limit of the position input */ setPositionLimits(minlimit: number, maxlimit: number): void; }