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 identify whether the target of input events? #240

Closed usernein closed 2 years ago

usernein commented 2 years ago

Hello, is there a way of identifying whether i'm changing the color via a slider or a wheel?

I actually use a wheel for selecting the color and a slider with sliderType==kelvin to adjust the color temperature. I'm using it in Home Assistant with a smart bulb.

I want to, whenever i adjust the temperature through the slider, adjust the temperature of my bulb so it will turn white, but the color and the temperature settings uses different methods so i need to identify which one i am actually adjusting to use the right method.

jaames commented 2 years ago

Not really possible to do this with a single color picker, but you could perhaps create separate color picker instances - one that just has a slider, one that just has a wheel, and then respond to events from them with whatever logic you wish.