-
Notifications
You must be signed in to change notification settings - Fork 20
API Documentation
minkyu-yi edited this page Apr 21, 2016
·
3 revisions
namespace:
tui.component.colorpicker
Create color picker instance.
Option | Description | Default Value |
---|---|---|
container | [Required] container element | |
color | default selected color of colorpicker | '#f8f8f8' |
preset | color preset for color palette | ['#181818', ... (base16 color)] |
cssPrefix | css prefix text for each child elements | 'tui-colorpicker-' |
detailTxt | text label for detail button | 'Detail' |
<div id="colorpicker"></div>
<script>
var colorpicker = tui.component.colorpicker.create({
container: document.getElementById('colorpicker'),
color: '#f9f9f9',
preset: ['#181818', '#292929', '#393939']
});
</script>
Set color to colorpicker instance. the string parameter must be hex color value ex) #ffff00
Get hex color string of current selected color in colorpicker instance.
Toggle colorpicker element. set true then reveal colorpicker view.
Destroy colorpicker instance.
Property | Description |
---|---|
color | selected color string (hex) |
origin | 'palette' or 'slider'. it is 'palette' when user click color chip in palette view. otherwise value is 'slider.' |
colorpicker.on('selectColor', function(e) {
console.log(e.color);
console.log(e.origin); // 'palette', 'slider'
});