viclafouch / mui-color-input

📌 A color input designed for MUI (Material ui) V6 built with TinyColor
https://viclafouch.github.io/mui-color-input/
60 stars 20 forks source link

Format 'hex' should hide the opacity slider #39

Open Radivarig opened 1 month ago

Radivarig commented 1 month ago

As mentioned here #33 the opacity slider cannot be changed, which is the case when the format is set to hex and outputs the color to a string of length 6 rrggbb, discarding the opacity values which live in the last two characters of a color string of length 8.

If the format is changed to hex8 the opacity slider starts working.

I suggest:

  1. hiding the opacity slider when format is hex to avoid confusion
  2. making opacity optional, when it equals 1 to generate rrggbb, when it is less than 1 to generate rrggbbaa