@fabwcie/free-drawing / components/ColorPicker
components/ColorPicker
Classes
ColorPicker
Defined in: packages/free-drawing/src/components/ColorPicker/ColorPicker.ts:13
Palette buttons, optional transparent button, custom color input and eyedropper (browsers with the EyeDropper API), added to given container
Constructors
Constructor
new ColorPicker(
$container,options):ColorPicker
Defined in: packages/free-drawing/src/components/ColorPicker/ColorPicker.ts:28
Create palette buttons, custom color input and eyedropper, none pressed until setColor
Parameters
$container
HTMLElement
Element receiving the buttons, then the custom input and the eyedropper
options
Palette, attribute and class of buttons, transparent button, change callback and texts
Returns
Properties
$buttons
readonly$buttons:HTMLButtonElement[] =[]
Defined in: packages/free-drawing/src/components/ColorPicker/ColorPicker.ts:15
Palette buttons (transparent button last), pressed for the current color
$customInput
readonly$customInput:HTMLInputElement
Defined in: packages/free-drawing/src/components/ColorPicker/ColorPicker.ts:17
Native color input for a color out of the palette, highlighted when the current color is not in it
$pickButton?
readonlyoptional$pickButton?:HTMLButtonElement
Defined in: packages/free-drawing/src/components/ColorPicker/ColorPicker.ts:19
Button picking a color anywhere on the screen (EyeDropper API of Chromium), undefined without it
options
privatereadonlyoptions:ColorPickerOptions
Defined in: packages/free-drawing/src/components/ColorPicker/ColorPicker.ts:21
Options given on creation
Methods
setColor()
setColor(
color):void
Defined in: packages/free-drawing/src/components/ColorPicker/ColorPicker.ts:95
Show current color: its palette button, or custom input when not in palette
Parameters
color
Current color, compared with palette colors once normalized
Returns
void