jaames / iro.js

🎨 Modular color picker widget for JavaScript, with support for a bunch of color formats

Home Page:https://iro.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to set initial color without triggering color:change callback? (solved)

wrybread opened this issue · comments

When I set the color when the page first loads:

colorPicker.color.set("rgb(255, 16, 65)");

It fires my color:change callback, which makes my script think someone has selected a color.

colorPicker.on('color:change', function(color) {
  send_color(color.rgb);
});

This breaks my script since I only want to send the color choice if it was manually selected.

Is there a way to set the initial color color on the picker without triggering the color:change callback?

Sorry, solved, changed event to input:change.