Closed jcogs-design closed 2 years ago
Answered my own question... you need to explicitly specify alpha even if it is already set... which seems both odd and unnecessary. Vis... to get my conversion to work I need to enter
$the_rgba_colour = $the_colour->toRgba($the_colour->alpha());
This works, but maybe the conversions for color formats that support transparency should check to see if an alpha value has already been set before using a default (if no value passed as a parameter)?
Dear contributor,
because this issue seems to be inactive for quite some time now, I've automatically closed it. If you feel this issue deserves some attention from my human colleagues feel free to reopen it.
I did this:
This creates a
Spatie\Color\Hsla
object with this value:If I now convert this to RGBA thusly:
I get a
Spatie\Color\Rgba
object with this value:The correct value of alpha in this case should be 0.76.
Does anyone know why I get this result? I don't think I'm doing anything wrong vis the library, but would value thoughts.
Use of
Factory::fromString()
rather than a specific colour format object is simply due to use case being considered one where it is uncertain what colour format string might be supplied.Thanks in advance for anyone who can offer any insight etc.