react-native icon indicating copy to clipboard operation
react-native copied to clipboard

[iOS] Add basic DisplayP3 color support

Open ryanlntn opened this issue 1 year ago • 5 comments

Summary:

This adds initial support for wide gamut (DisplayP3) colors to React Native iOS per the RFC. It provides the ability to set the default color space to sRGB or DisplayP3 and provides the native code necessary to support color() function syntax per the W3C CSS Color Module Level 4 spec. It does not yet support animations and requires additional JS code before fully supporting the color() function syntax.

Changelog:

[IOS] [ADDED] - Add basic DisplayP3 color support

Test Plan:

Screenshot_20240131-100112

Follow test steps from #42831 to test support for color() function syntax.

To globally change the default color space to DisplayP3 make the following changes to RNTester AppDelegate.mm:

+ #import <React/RCTConvert.h>

   - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
   {
     // ...
+    RCTSetDefaultColorSpace(RCTColorSpaceDisplayP3);
     return [super application:application didFinishLaunchingWithOptions:launchOptions];
   }

ryanlntn avatar Feb 03 '24 03:02 ryanlntn

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 17,242,525 +9,239
android hermes armeabi-v7a n/a --
android hermes x86 n/a --
android hermes x86_64 n/a --
android jsc arm64-v8a 20,608,998 +8,893
android jsc armeabi-v7a n/a --
android jsc x86 n/a --
android jsc x86_64 n/a --

Base commit: bc3fe0d76d9ca7613115d5f10b85ba7608561c02 Branch: main

analysis-bot avatar Feb 03 '24 03:02 analysis-bot

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

facebook-github-bot avatar Feb 03 '24 10:02 facebook-github-bot

@cipolleschi Thanks! That worked after I also updated React-graphics to only pull in React-jsi instead of all of React-Core.

ryanlntn avatar Feb 06 '24 20:02 ryanlntn

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

facebook-github-bot avatar Feb 07 '24 15:02 facebook-github-bot

Hi @ryanlntn, quick update on this: I'm having non-trivial issues making this build internally with BUCK2. I hope I'll be able to get it working by today or next week at most...

cipolleschi avatar Feb 23 '24 10:02 cipolleschi

@cipolleschi merged this pull request in facebook/react-native@a40bd8e34a4de61e9f7690f808fe978fab1df11c.

facebook-github-bot avatar Feb 27 '24 13:02 facebook-github-bot