discussions-and-proposals icon indicating copy to clipboard operation
discussions-and-proposals copied to clipboard

Add Support for Wide Gamut (DisplayP3) Colors to React Native

Open ryanlntn opened this issue 2 years ago • 5 comments

React Native does not currently support wide gamut color spaces (i.e. DisplayP3). This proposal discusses adding support for this color space in React Native.

Thanks to @cipolleschi for his support in drafting this proposal!

ryanlntn avatar Dec 01 '23 17:12 ryanlntn

Also FYI @vincentriemer as someone who has been interested in extended color space before.

NickGerleman avatar Dec 02 '23 02:12 NickGerleman

cc @andreialecu who is also interested in this topic.

my understanding is that, unlike flutter to draw everything by their own. by leveraging the UIImage, we have the display p3 support already. the only missing piece is our coloring system as this pr pointed out.

alternatively, i was thinking to change from native code only without touching js code. if the screen supports display p3, we should just use the display p3 UIColor methods. having a small poc here: https://github.com/Kudo/displayp3/blob/main/modules/p3color/ios/p3colorView.swift we can check whether the view support display p3 by self.traitCollection.displayGamut. then we can get this information from RCTRootView and pass down to some new UIColor factory.

Kudo avatar Dec 04 '23 17:12 Kudo

Hi everyone, thanks for chiming in and for providing your feedback! :D

alternatively, i was thinking to change from native code only without touching js code. if the screen supports display p3, we should just use the display p3 UIColor methods. having a small poc here: Kudo/displayp3@main/modules/p3color/ios/p3colorView.swift we can check whether the view support display p3 by self.traitCollection.displayGamut. then we can get this information from RCTRootView and pass down to some new UIColor factory.

@Kudo unfortunately we can't go all-in and update everything, even if I agree that it will look better. We have several tests that will fail internally if we do that, and other companies could incur in the same issues. Also, some designers might not be happy to see that the app colors suddenly changed to different ones. 😅

cipolleschi avatar Dec 18 '23 15:12 cipolleschi

A tweet around this went semi-viral https://twitter.com/lauridskern/status/1717237553886081252

henrymoulton avatar Jan 30 '24 18:01 henrymoulton