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

feat: Add expanded support for CSS Colors #34600

Conversation

gabrieldonadel
Copy link
Collaborator

@gabrieldonadel gabrieldonadel commented Sep 6, 2022

Summary

This PR adds expanded support for CSS Colors, as requested on #34425. It updates the current regex used to match the functional notation for colors, e.g rgb() to accept space as a valid separator between values as specified on CSS Color Module Level 4 definition. This also adds support for the hwb notation.

Changelog

[General] [Added] - Add expanded support for CSS Colors

Test Plan

We can test different color scenarios through the new test cases added to the already existing normalizeColor-test.js

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 6, 2022
@react-native-bot react-native-bot added the Type: Enhancement A new feature or enhancement of an existing feature. label Sep 6, 2022
@analysis-bot
Copy link

analysis-bot commented Sep 6, 2022

Platform Engine Arch Size (bytes) Diff
ios - universal n/a --

Base commit: 37d0a25
Branch: main

@analysis-bot
Copy link

analysis-bot commented Sep 6, 2022

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 7,638,456 +1,360
android hermes armeabi-v7a 7,050,454 +1,147
android hermes x86 7,940,414 +1,528
android hermes x86_64 7,912,442 +1,624
android jsc arm64-v8a 9,513,952 +1,078
android jsc armeabi-v7a 8,289,246 +853
android jsc x86 9,453,493 +1,228
android jsc x86_64 10,044,742 +1,336

Base commit: 37d0a25
Branch: main

@gabrieldonadel gabrieldonadel marked this pull request as ready for review September 6, 2022 03:31
Copy link
Contributor

@necolas necolas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add tests for rgba(255 255 255 / 0.5) syntax, and for space-separated hsl, hsla, etc.

@facebook-github-bot facebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Sep 6, 2022
Copy link
Contributor

@cipolleschi cipolleschi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment from @necolas

@facebook-github-bot
Copy link
Contributor

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

@gabrieldonadel
Copy link
Collaborator Author

We should add tests for rgba(255 255 255 / 0.5) syntax, and for space-separated hsl, hsla, etc.

Sure, I've added a new regex so we can support the / notation and added new test cases

@facebook-github-bot
Copy link
Contributor

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

@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by @gabrieldonadel in ac1fe3b.

When will my fix make it into a release? | Upcoming Releases

@react-native-bot react-native-bot added the Merged This PR has been merged. label Sep 7, 2022
OlimpiaZurek pushed a commit to OlimpiaZurek/react-native that referenced this pull request May 22, 2023
Summary:
## Summary

This PR adds expanded support for CSS Colors, as requested on facebook#34425. It updates the current regex used to match the functional notation for colors, e.g `rgb()` to accept space as a valid separator between values as specified on [CSS Color Module Level 4](https://www.w3.org/TR/css-color-4/) definition. This also adds support for the `hwb` notation.

## Changelog

[General] [Added] - Add expanded support for CSS Colors

Pull Request resolved: facebook#34600

Test Plan: We can test different color scenarios through the new test cases added to the already existing normalizeColor-test.js

Reviewed By: necolas

Differential Revision: D39269360

Pulled By: cipolleschi

fbshipit-source-id: 449158d17256bbab8bd9fd0da29245660225fb92
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. Type: Enhancement A new feature or enhancement of an existing feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants