Skip to content

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

Open

Description

@FirstVertex

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

Activity

  1. added
    feature request
    and removed
    bug
    on Dec 10, 2020
  2. changed the title [-]Cannot turn off alpha in text input[/-] [+]Remove alpha field from color-functions if lockOpacity is set to true[/+] on Dec 10, 2020
  3. Teraskull commented on Mar 12, 2021

    @Teraskull

    For now you can do something like this:

    color.toRGBA().toString(0).replace(', 1)', ')').replace('rgba', 'rgb');
    
  4. added
    bug
    on Mar 13, 2021
  5. simonwep commented on Mar 13, 2021

    @simonwep
    Owner

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

  6. added
    improvement
    and removed
    feature request
    bug
    on Mar 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    improvement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions