grav-plugin-admin icon indicating copy to clipboard operation
grav-plugin-admin copied to clipboard

Colorpicker format and validation

Open OleVik opened this issue 2 years ago • 0 comments

With Admin v1.10.30.1, the colorpicker seemingly supports two formats: Hex and RGBA, but not RGB.

For example, when a blueprint uses the color rgb(255, 138, 128), it renders fine:

image

When you click the field, the colorpicker-composes interprets it as a hex-value and transforms it into #ff8a80:

image

If you then click the transparent-button, it gets interpreted back to RGB with an alpha-channel set to 0:

image

Whereas it should be rgba(255, 138, 128, 1.00). But why isn't RGB simply supported? With a simple list of colors, like

colors:
  - name: White
    value: "rgb(250, 250, 250)"
  - name: Red
    value: "rgb(255, 138, 128)"
  - name: Orange
    value: "rgb(255, 209, 128)"

these will not fit the pattern-validation, and when trying to save settings in a blueprint it will practically go through each one, transforming them to the nearest Hex. Is the solution #921 not sufficient?

OleVik avatar Mar 18 '22 21:03 OleVik