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

[Genernal] Added slash of alpha support using rgb() #50281

Closed
wants to merge 3 commits into from

Conversation

zhongwuzw
Copy link
Contributor

@zhongwuzw zhongwuzw commented Mar 26, 2025

Summary:

Fixes #50207

Added slash alpha support like rgb(255 122 127 / 0.2);, currently seems we don't support it.

Changelog:

[GENERAL] [ADDED] - Added slash of alpha support using rgb()

Test Plan:

rgb(255 122 127 / 0.2) can shows correctly.

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels Mar 26, 2025
@javache javache requested a review from NickGerleman March 26, 2025 14:15
@NickGerleman
Copy link
Contributor

NickGerleman commented Mar 26, 2025

CSS colors module level 4 also allows rgba() to not contain alpha. We could unify these paths. https://www.w3.org/TR/css-color-4/#rgb-functions

rgb() legacy syntax (using comma) is also allowed to contain alpha.

Another existing bug here, is that we shouldn't allow slash notation at all when using comma separator, but existing regex supports this.

All of this will eventually get replaced in new arch by https://github.com/facebook/react-native/blob/main/packages/react-native/ReactCommon/react/renderer/css/CSSColorFunction.h but this is further out. Making fixes to existing impl like this makes sense to me.

@zhongwuzw
Copy link
Contributor Author

@NickGerleman Please review again.

@facebook-github-bot
Copy link
Contributor

@NickGerleman has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Mar 29, 2025
@facebook-github-bot
Copy link
Contributor

@NickGerleman merged this pull request in 7441127.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

alpha ignored in modern rgb() syntax
3 participants