kallookoo / wp-color-picker-alpha

Overwrite Automattic Iris for enabled Alpha Channel in wpColorPicker
GNU General Public License v2.0
132 stars 88 forks source link

Mixed palette causes weird behaviour #19

Closed 7studio closed 4 years ago

7studio commented 6 years ago

Hi Sergio,

Thank you for this project. I discovered it with the help of ACF RGBA Color Picker but I encounter an issue in my own plugin when I use a mixed palette like this one:

#ff0000
rgb(0,255,0)
rgba(0, 0, 255, 1)
rgba(80, 180, 255, .4)
rgba(255, 180, 80, .7)

I am aware about the data-reset-alpha attribute but it doesn't solve my problem because:

  1. when I don't use it, the alpha follows the colours when I switch between rgba to rgb or hex value (even if the colour comes from the defined palette).
  2. when I use it, the alpha of rgba values in palette is set to 1 every time I choose it.

The only solution that I found is to transform rgb and hex values to rgba equivalent with a 1 alpha…

Could the project reset the alpha value when the colour comes from the palette? Especially when you know that the palette was defined by a developer who chose these specific values.

kallookoo commented 6 years ago

Hi @7studio, I apologize for taking so long to answer you, I am modifying the script to support palettes with mixed values (hex, rgb, rgba) I warn you when I upload it for you to try it, I'll create another branch called beta, until I'm sure it works 100%.

In this week there will be new news!

7studio commented 6 years ago

Hi @kallookoo,

Don't be worry about your late answer. I'm enthousiast that you take into account my need :) Actually my ACF plugin 7studio/acf-color-palette works well with my workaround (translate rgb and hex to rgba).

Don't be hesitant to ping me if you want I will try your beta branch with my work.

Thank you, Xavier.

kallookoo commented 4 years ago

Hi, Try the branch 3.0.0 and comment please.

kallookoo commented 4 years ago

Checked and maintains colors. Just one detail and that is if for example it is defined as hex it converts it to rgb, but I don't see it as a problem.