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

mix returns NaN values at extremes with fully transparent colors #408

Closed
delucis opened this issue Jan 1, 2022 · 1 comment · Fixed by #409
Closed

mix returns NaN values at extremes with fully transparent colors #408

delucis opened this issue Jan 1, 2022 · 1 comment · Fixed by #409
Labels

Comments

@delucis
Copy link
Contributor

delucis commented Jan 1, 2022

When using the mix function with a colour that is fully transparent, it returns a value of "rgba(NaN, NaN, NaN, 0)" if the weight is fully at the transparent end of the two colors. Some examples:

// Not OK — these all return "rgba(NaN, NaN, NaN, 0)"
mix('red', 'transparent', 1);
mix('transparent', 'red', 0);
mix('rgba(0, 0, 0, 0)', 'red', 0);
mix('red', 'rgba(0, 0, 0, 0)', 1);

As soon as the colour is not fully transparent, or the weight is not at the extreme end of its range, the values are valid.

// OK
mix('rgba(0, 0, 0, 0.01)', 'red', 0); // "rgba(0, 0, 0, 0.01)"
mix('transparent', 'red', 0.01); // "rgba(255, 0, 0, 0.01)"

Curiously, the even edgier case of a transparent–transparent gradient works fine:

// Also OK
mix('transparent', 'transparent', 0); // "rgba(0, 0, 0, 0)"

I’m guessing there’s a divide by zero error somewhere maybe.

@github-actions
Copy link

github-actions bot commented Jan 2, 2022

🎉 This issue has been resolved in version 1.2.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging a pull request may close this issue.

1 participant