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

RGB and Alpha sliders not keeping alpha value on interaction

lenadax opened this issue · comments

Version: 5.5.2

Description:

On an iro color picker with a custom layout containing red / green / blue and alpha sliders, on sliding the alpha slider first, then sliding any of the red/green/blue sliders resets the alpha value to 1.
This behaviour only occurs on rgb/kelvin sliders in combination with alpha slider.

Minimal reproduction:

Consider the following pen: RGBA Slider Example
Create a color Picker with the following properties:

var colorPicker = new iro.ColorPicker(".yourElement", {
  color: "rgb(255, 0, 0)",
  layout: [
    {component: iro.ui.Slider, options: {sliderType: 'red'}},
    {component: iro.ui.Slider, options: {sliderType: 'alpha'}}
]});

Next, slide the alpha slider to a value below 1.
Then slide the red slider to any value.

Output: on sliding the red slider, alpha value gets reset to 1.
rgbaString also shows an alpha value of 1.
In the pen, we see that alpha value is preserved sliding the hue slider, but not while sliding the red slider.

I don't know if this is in fact intended behaviour, but for functionality I would prefer the active Color keep its alpha value in this case!