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

decomposeColor has null value when string has whitespace #44504

Open
rdougan opened this issue Nov 21, 2024 · 0 comments
Open

decomposeColor has null value when string has whitespace #44504

rdougan opened this issue Nov 21, 2024 · 0 comments
Labels
status: waiting for maintainer These issues haven't been looked at yet by a maintainer

Comments

@rdougan
Copy link

rdougan commented Nov 21, 2024

Steps to reproduce

Steps:

  1. Open this link to live example: https://codesandbox.io/p/sandbox/blissful-fog-kc3xy8
decomposeColor('#aa0099 ');
//{"type":"rgba","values":[170,0,153,null]}

darken('#aa0099 ', 0.5);
//rgba(85, 0, 76, NaN)

Current behavior

Alpha value returned by decomposeColor is null when the color string passed has whitespace before/after value. Due to this, darken (and probably other functions) return NaN when calculating proper values.

Expected behavior

Trim whitespace, or give a warning in the console.

Context

No response

Your environment

npx @mui/envinfo
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

Search keywords: decomposeColor darken NaN

@rdougan rdougan added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting for maintainer These issues haven't been looked at yet by a maintainer
Projects
None yet
Development

No branches or pull requests

1 participant