pickr icon indicating copy to clipboard operation
pickr copied to clipboard

Remove alpha field from color-functions if lockOpacity is set to true

Open FirstVertex opened this issue 4 years ago • 2 comments

Bug Report

Hi there! I'm trying to disable any selection of alpha channel, our application does not support it.

I set input options like

{
  lockOpacity: true,
  components: {
    opacity: false
  }
}

This has the desired effect of suppressing UI elements for the user to use mouse for selecting transparency. Also this has the desired effect of changing button text of RGBA to RGB and HSLA to HSL.

Here are the problems that arise:

  1. The text input still contains rgba() and hsla() functions. Expect these to only contain rgb() and hsl()
  2. These rgba and hsla representations do not match the text of the buttons that triggered them (RGB/HSL).
  3. The user can type an alpha value into the text input, but it is reset to 1 when the text input is blurred

Stackblitz

I prepared this Stackblitz to demo the issue https://stackblitz.com/edit/js-qur2ih

FirstVertex avatar Dec 04 '20 21:12 FirstVertex

For now you can do something like this:

color.toRGBA().toString(0).replace(', 1)', ')').replace('rgba', 'rgb');

Teraskull avatar Mar 12 '21 22:03 Teraskull

Okay, that is unexpected and not well-implemented. I'll see what I can do :)

simonwep avatar Mar 13 '21 10:03 simonwep