jaames / iro.js

🎨 Modular color picker widget for JavaScript, with support for a bunch of color formats
https://iro.js.org
Mozilla Public License 2.0
1.3k stars 81 forks source link

How to change or destroy color picker #210

Closed marekburiak closed 2 years ago

marekburiak commented 2 years ago

More of a question than an issue. Or maybe a feature request.

Is there a way to change options after color picker is created? Like for example to change layout. If not, is there a clean way to destroy an existing color picker (without causing memory leaks)?

jaames commented 2 years ago

You can use the setOptions methods to pass new options to a color picker after it's been created, e.g:


const picker = new iro.ColorPicker("#picker", { 
  width: 300
});

// sometime later 
picker.setOptions({
  width: 400
});

Hope that helps!