Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails with HSL with floats #89

Open
mwargan opened this issue Sep 14, 2024 · 1 comment
Open

Fails with HSL with floats #89

mwargan opened this issue Sep 14, 2024 · 1 comment

Comments

@mwargan
Copy link

mwargan commented Sep 14, 2024

Given a value like hsl(221, 11.52%, 32.35%), Factory::fromString(hsl(221, 11.52%, 32.35%))->toHex(); fails to parse the colour.

@Afrowson
Copy link
Contributor

Afrowson commented Nov 13, 2024

I got the same issue with an HSLA value:

Hsla color string `hsla(357,100%,44.5%,1)` is malformed. 
An hsla color contains hue, saturation, lightness and alpha values, wrapped in `hsl()`, e.g. `hsl(300,10%,50%,0.25)`.

this error message is funny as it is wrong as well. should be wrapped in 'hsla()',

as the validation regex is checking for hsla:
preg_match('/^ *hsla\( *\d{1,3} *, *\d{1,3}%? *, *\d{1,3}%? *, *[0-1](\.\d{1,2})? *\) *$/i', $string))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants