color icon indicating copy to clipboard operation
color copied to clipboard

Unable to parse RGBA no comma alpha value in percentage.

Open deadlyjack opened this issue 1 year ago • 6 comments

Unable to parse rgba(0 0 0 26%) color where it is a valid color and should be parsed. When passed the same color value including it comma or alpha value as ratio it is parsed correctly.

deadlyjack avatar Jul 08 '23 14:07 deadlyjack

Are you sure this is a valid part of the spec?

Qix- avatar Jul 08 '23 16:07 Qix-

Yes I'm sure.

Here is specification of rgb(a) color on MDN

<rgb()> = 
  rgb( [ <percentage> | none ]{3} [ / [ <alpha-value> | none ] ]? )  |
  rgb( [ <number> | none ]{3} [ / [ <alpha-value> | none ] ]? )  

<alpha-value> = 
  <number>      |
  <percentage>  

deadlyjack avatar Jul 08 '23 21:07 deadlyjack

Ah it's a new syntax change, fun. PR is welcome, both syntaxes need to be supported.

Qix- avatar Jul 09 '23 00:07 Qix-

Sure. Thanks for replying 🙂

deadlyjack avatar Jul 10 '23 04:07 deadlyjack

Unable to parse rgba(0 0 0 26%) color where it is a valid color and should be parsed. When passed the same color value including it comma or alpha value as ratio it is parsed correctly.

rgba(0 0 0 26%) isn't supported by browsers,rgba(0 0 0 / 26%) is ok.

yyuneko avatar Sep 10 '24 07:09 yyuneko

There's technically nothing about this package that mandates it's an exact parity of browser support. I think as long as this package is a superset of what the browsers support, so long as what is supported is to an official spec, then it's acceptable.

Qix- avatar Sep 10 '24 20:09 Qix-