I need more than one color picker on the same page, with only one active at the time. However, each new picker sets the color to all the previous ones at the same time.
<input id="a" onclick="edit(event)" value="#ff0000">
<input id="b" onclick="edit(event)" value="#ffff00">
<canvas id="canvas"></canvas>
<script src="lib/html5kellycolorpicker.min.js"></script>
<script>
edit = (event)=>{
var k = new KellyColorPicker({
place : 'canvas',
input : event.target,
color : event.target.innerHTML,
userEvents : { change : function(self) {
if(self.getCurColorHsv().v < 0.5)
self.getInput().style.color = "#FFF";
else
self.getInput().style.color = "#000";
self.getInput().style.background = self.getCurColorHex();
}
}});
}
</script>