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

fix(isRgbColor): allow more than one decimal on alpha #2378

Closed
wants to merge 1 commit into from

Conversation

marcopixel
Copy link

The current regex is only allowing for one decimal on the alpha value even though the specification has no limit on maximal decimals.

I've adjusted the regex + the tests accordingly and it does pass now if it has more than one decimal if set as number between 1 and 0.

References

https://www.w3.org/TR/css-color-3/#transparency

<alphavalue>: Syntactically a <number>.

https://www.w3.org/TR/2011/REC-CSS2-20110607/syndata.html#value-def-number

A <number> can either be an <integer>, or it can be zero or more digits followed by a dot (.) followed by one or more digits

Checklist

  • PR contains only changes related; no stray files, etc.
  • README updated (where applicable)
  • Tests written (where applicable)
  • References provided in PR (where applicable)

Copy link

codecov bot commented Mar 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (4197b86) to head (a75a9cd).

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #2378   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          107       107           
  Lines         2449      2449           
  Branches       619       619           
=========================================
  Hits          2449      2449           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@marcopixel
Copy link
Author

Sorry, i've just noticed that this is a duplicate of #2346 - the difference between these two pull requests is that mine doesn't limit to a second decimal point.

@WikiRik
Copy link
Member

WikiRik commented Mar 15, 2024

Let's discuss that difference in #2346

@WikiRik WikiRik closed this Mar 15, 2024
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

Successfully merging this pull request may close these issues.

2 participants