-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Support-rgb(R%,G%,B%)-percentage #2363
Merged
jakex7
merged 6 commits into
software-mansion:main
from
hryhoriiK97:Support-float-functional-rgb(R%,-G%,-B%)-syntactical-form
Aug 19, 2024
Merged
Support-rgb(R%,G%,B%)-percentage #2363
jakex7
merged 6 commits into
software-mansion:main
from
hryhoriiK97:Support-float-functional-rgb(R%,-G%,-B%)-syntactical-form
Aug 19, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hryhoriiK97
changed the title
Support-flot-functional-rgb(R%,G%,B%)-syntatical-form
Support-rgb(R%,G%,B%)-percentage
Jul 23, 2024
bohdanprog
added
enhancement
Platform: Android
This issue is specific to Android
Platform: iOS
This issue is specific to iOS
labels
Jul 26, 2024
Hey @jakex7, could you take a look at that? |
jakex7
requested changes
Jul 31, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, I've left some comments
…d it's usage in extractBrush
jakex7
force-pushed
the
Support-float-functional-rgb(R%,-G%,-B%)-syntactical-form
branch
from
August 19, 2024 08:09
7baa99b
to
2a6d02f
Compare
jakex7
approved these changes
Aug 19, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for contribution 🎉
github-merge-queue bot
referenced
this pull request
in valora-inc/wallet
Sep 24, 2024
This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [react-native-svg](https://github.com/react-native-community/react-native-svg) | [`^15.5.0` -> `^15.7.1`](https://renovatebot.com/diffs/npm/react-native-svg/15.5.0/15.7.1) | [![age](https://developer.mend.io/api/mc/badges/age/npm/react-native-svg/15.7.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/react-native-svg/15.7.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/react-native-svg/15.5.0/15.7.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/react-native-svg/15.5.0/15.7.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>react-native-community/react-native-svg (react-native-svg)</summary> ### [`v15.7.1`](https://github.com/software-mansion/react-native-svg/releases/tag/v15.7.1) [Compare Source](https://github.com/react-native-community/react-native-svg/compare/v15.7.0...v15.7.1) Hotfix for v15.7.0 #### What's Changed - fix: exclude e2e from types in release by [@​jakex7](https://github.com/jakex7) in #[https://github.com/software-mansion/react-native-svg/pull/2454](https://github.com/software-mansion/react-native-svg/pull/2454) **Full Changelog**: software-mansion/react-native-svg@v15.7.0...v15.7.1 ### [`v15.7.0`](https://github.com/software-mansion/react-native-svg/releases/tag/v15.7.0) [Compare Source](https://github.com/react-native-community/react-native-svg/compare/v15.6.0...v15.7.0) A minor release introducing the implementation of filter regions along with some bug fixes 🔧 #### What's Changed - fix: android svg scale 0 by [@​jakex7](https://github.com/jakex7) in [https://github.com/software-mansion/react-native-svg/pull/2424](https://github.com/software-mansion/react-native-svg/pull/2424) - feat: e2e snapshot tests by [@​CDFN](https://github.com/CDFN) in [https://github.com/software-mansion/react-native-svg/pull/2338](https://github.com/software-mansion/react-native-svg/pull/2338) - feat: add load method by [@​WoLewicki](https://github.com/WoLewicki) in [https://github.com/software-mansion/react-native-svg/pull/2427](https://github.com/software-mansion/react-native-svg/pull/2427) - fix: reset paint settings before drawing final bitmap by [@​jakex7](https://github.com/jakex7) in [https://github.com/software-mansion/react-native-svg/pull/2439](https://github.com/software-mansion/react-native-svg/pull/2439) - fix: add deprecated SvgViewManager to not break 0.72 by [@​jakex7](https://github.com/jakex7) in [https://github.com/software-mansion/react-native-svg/pull/2435](https://github.com/software-mansion/react-native-svg/pull/2435) - docs: introduce about webpack by [@​bohdanprog](https://github.com/bohdanprog) in [https://github.com/software-mansion/react-native-svg/pull/2434](https://github.com/software-mansion/react-native-svg/pull/2434) - docs: broken link in the readme file by [@​JohnAdib](https://github.com/JohnAdib) in [https://github.com/software-mansion/react-native-svg/pull/2443](https://github.com/software-mansion/react-native-svg/pull/2443) - feat: implement filter region by [@​jakex7](https://github.com/jakex7) in [https://github.com/software-mansion/react-native-svg/pull/2441](https://github.com/software-mansion/react-native-svg/pull/2441) - fix: Android group `opacity` prop by [@​jakex7](https://github.com/jakex7) in [https://github.com/software-mansion/react-native-svg/pull/2417](https://github.com/software-mansion/react-native-svg/pull/2417) - fix: render G offscreen only when it's needed (opacity != 1) by [@​jakex7](https://github.com/jakex7) in [https://github.com/software-mansion/react-native-svg/pull/2450](https://github.com/software-mansion/react-native-svg/pull/2450) - fix: transform scale on android by [@​jakex7](https://github.com/jakex7) in [https://github.com/software-mansion/react-native-svg/pull/2452](https://github.com/software-mansion/react-native-svg/pull/2452) #### New Contributors - [@​JohnAdib](https://github.com/JohnAdib) made their first contribution in [https://github.com/software-mansion/react-native-svg/pull/2443](https://github.com/software-mansion/react-native-svg/pull/2443) **Full Changelog**: software-mansion/react-native-svg@v15.6.0...v15.7.0 ### [`v15.6.0`](https://github.com/software-mansion/react-native-svg/releases/tag/v15.6.0) [Compare Source](https://github.com/react-native-community/react-native-svg/compare/v15.5.0...v15.6.0) In this version, we've introduced support for React Native 0.75, Fabric support on Windows, and a few minor enhancements and fixes. Thank you to everyone who contributed! 🚀 #### What's Changed - chore: bump reanimated in macos example on paper by [@​jakex7](https://github.com/jakex7) in [https://github.com/software-mansion/react-native-svg/pull/2398](https://github.com/software-mansion/react-native-svg/pull/2398) - feat: add support int32 color by [@​bohdanprog](https://github.com/bohdanprog) in [https://github.com/software-mansion/react-native-svg/pull/2397](https://github.com/software-mansion/react-native-svg/pull/2397) - fix: implementation toDataURL for iOS platform both architectures by [@​bohdanprog](https://github.com/bohdanprog) in [https://github.com/software-mansion/react-native-svg/pull/2405](https://github.com/software-mansion/react-native-svg/pull/2405) - chore: cleanup example apps by [@​jakex7](https://github.com/jakex7) in [https://github.com/software-mansion/react-native-svg/pull/2408](https://github.com/software-mansion/react-native-svg/pull/2408) - feat(windows): add fabric support by [@​marlenecota](https://github.com/marlenecota) in [https://github.com/software-mansion/react-native-svg/pull/2321](https://github.com/software-mansion/react-native-svg/pull/2321) - feat: support dataUri for android platform by [@​bohdanprog](https://github.com/bohdanprog) in [https://github.com/software-mansion/react-native-svg/pull/2396](https://github.com/software-mansion/react-native-svg/pull/2396) - feat: introduce hitSlop prop by [@​jakex7](https://github.com/jakex7) in [https://github.com/software-mansion/react-native-svg/pull/2407](https://github.com/software-mansion/react-native-svg/pull/2407) - feat: rewrite `Svg` transform by [@​jakex7](https://github.com/jakex7) in [https://github.com/software-mansion/react-native-svg/pull/2403](https://github.com/software-mansion/react-native-svg/pull/2403) - Support-rgb(R%,G%,B%)-percentage by [@​hryhoriiK97](https://github.com/hryhoriiK97) in [https://github.com/software-mansion/react-native-svg/pull/2363](https://github.com/software-mansion/react-native-svg/pull/2363) - chore: bump apps to RN 0.75 by [@​WoLewicki](https://github.com/WoLewicki) in [https://github.com/software-mansion/react-native-svg/pull/2340](https://github.com/software-mansion/react-native-svg/pull/2340) - chore(deps): bump rexml from 3.2.6 to 3.3.3 in /tests-example by [@​dependabot](https://github.com/dependabot) in [https://github.com/software-mansion/react-native-svg/pull/2410](https://github.com/software-mansion/react-native-svg/pull/2410) - chore: fix prettier by [@​jakex7](https://github.com/jakex7) in [https://github.com/software-mansion/react-native-svg/pull/2416](https://github.com/software-mansion/react-native-svg/pull/2416) - fix: do not resolve asset url for every object on web. by [@​jakex7](https://github.com/jakex7) in [https://github.com/software-mansion/react-native-svg/pull/2419](https://github.com/software-mansion/react-native-svg/pull/2419) - fix: transforms on macOS old arch by [@​jakex7](https://github.com/jakex7) in [https://github.com/software-mansion/react-native-svg/pull/2420](https://github.com/software-mansion/react-native-svg/pull/2420) #### New Contributors - [@​hryhoriiK97](https://github.com/hryhoriiK97) made their first contribution in [https://github.com/software-mansion/react-native-svg/pull/2363](https://github.com/software-mansion/react-native-svg/pull/2363) **Full Changelog**: software-mansion/react-native-svg@v15.5.0...v15.6.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "after 5pm,every weekend" in timezone America/Los_Angeles, Automerge - "after 5pm,every weekend" in timezone America/Los_Angeles. 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/valora-inc/wallet). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC44MC4wIiwidXBkYXRlZEluVmVyIjoiMzguODAuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsibnBtIiwicmVub3ZhdGUiXX0=--> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: valora-bot <valorabot@valoraapp.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
enhancement
Platform: Android
This issue is specific to Android
Platform: iOS
This issue is specific to iOS
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Closes #1897
In our project, we encountered a problem with SVGs that include RGB/RGBA color values in percentage format. To address this, I've decided to handle it within the react-native-svg library.
Also, I found an open issue for this - #1897
percentTo255
: Converts a percentage string (e.g., 50%) to its corresponding integer value on a scale of 0-255. This is done by parsing the percentage as a float and multiplying by 2.55 (since 100% equals 255 in RGB).parseAlpha
: Converts the alpha component to a float between 0 and 1. If the alpha is a percentage, it divides by 100; otherwise, it parses it as a float directly.parsePercentageRGBColor
: This function takes a color string as input and attempts to match it against the RGB_PATTERN or RGBA_PATTERN. If a match is found, it extracts the red, green, blue, and optional alpha components. It then converts these components from their percentage form to the 0-255 range (or normalized float for alpha). The function returns the color in standard rgb(r, g, b) or rgba(r, g, b, a) format. If the input color string does not match the patterns, it logs a warning and returns undefinedtransformColorToPercentage
: This function checks if the given color value (which can be of type ColorValue from React Native) is a string matching the percentage-based RGB or RGBA patterns. It removes any whitespace from the color string and tests it against the patterns. If the color matches, it converts it usingparsePercentageRGBColor
. If not, it returns the original color value unchanged.Test Plan
Run test-examples with Test2363
Compatibility
Checklist
README.md