Skip to content

Value is converted automatically in rgb #5

Open
@jcgueriaud1

Description

@jcgueriaud1

Hi,

If I have a color picker field with a non rgb, open the color picker then click on select (with no change on the value). The color is converted to rgb.
You can try on the demo here: https://appreciated-collection.herokuapp.com/color-picker-field/

Open the "As String" --lumo-primary-color, click on select. the color is changed to rgb(0,0,0).

Works the same way in all browsers.

I think it's because of this:

  _updateSelectedColor(color) {
    this._selectColorButtonColor.style.background = color.toRgbString();
    this._selectColorButtonIcon.style.color = ColorPickerUtils.getContrastColor(color);
    this._popUpColor = color.toRgbString();
    this._previousColor = color.toRgbString();
  }

I tried this:

  _updateSelectedColor(color) {
    this._selectColorButtonColor.style.background = color.toRgbString();
    this._selectColorButtonIcon.style.color = ColorPickerUtils.getContrastColor(color);
   /// _popColor has already the correct color don't need to convert it to rgb
   /////  this._popUpColor = color.toRgbString();
    this._previousColor = color.toRgbString();
  }

It seems to work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions