logo

/Color Picker|v2.2.8

Class

new ColorPicker(options)factory.jsline 50

PARAMETERS
NameTypeDescription

options

object

options for colorpicker component

PROPERTIES
NameTypeDescription

container

HTMLDivElement

container element

color

string = '#ffffff'

default selected color

preset

[ Array ]

color preset for palette (use base16 palette if not supplied)

cssPrefix

string = 'tui-colorpicker-'

css prefix text for each child elements

detailTxt

string = 'Detail'

text for detail button.

usageStatistics

boolean = true

Let us know the hostname. If you don't want to send the hostname, please set to false.

EXAMPLES
// ES6
import colorPicker from 'tui-color-picker';

// CommonJS
const colorPicker = require('tui-color-picker');

// Browser
const colorPicker = tui.colorPicker;

const instance = colorPicker.create({
  container: document.getElementById('color-picker')
});

Instance Methods

destroy()factory.jsline 266

Destroy colorpicker instance.

EXAMPLES
instance.destroy(); // DOM-element is removed

getColor()factory.jsline 236

Get hex color string of current selected color in colorpicker instance.

RETURNS:
{

string

} - hex string formatted color
EXAMPLES
instance.setColor('#ffff00');
instance.getColor(); // '#ffff00';

setColor(hexStr)factory.jsline 220

Set color to colorpicker instance.
The string parameter must be hex color value

PARAMETERS
NameTypeDescription

hexStr

string

hex formatted color string

EXAMPLES
instance.setColor('#ffff00');

toggle(isShow)factory.jsline 248

Toggle colorpicker element. set true then reveal colorpicker view.

PARAMETERS
NameTypeDescription

isShow

boolean = false

A flag to show

EXAMPLES
instance.toggle(false); // hide
instance.toggle(); // hide
instance.toggle(true); // show

Events

selectColorfactory.jsline 158

PROPERTIES
NameTypeDescription

color

string

selected color (hex string)

origin

string

flags for represent the source of event fires.

Resizable