Matching colors between launch screen storyboard and Metal

I have a launch screen storyboard that's simply a single solid color. Once the app launches, I begin rendering with Metal, clearing the screen using the same color. The goal is for the colors to match exactly between the launch screen and Metal. However, the launch screen color that's actually rendered on the device is different from what's specified in the storyboard, causing the color to differ between the launch screen and Metal.


As an example, say the color is:


102 255 0


If I use this as the clear color for Metal, take a screenshot on the device, and check the color in an image editing program, I get (102 255 0), as desired. However, the same color specified in the storyboard using the sRGB color profile yields an actual color in the screenshot of (101 254 0). Obviously the difference is small, but nevertheless I'd like the values to match exactly.


I understand that iOS's goal here is consistent perceived color and not necessarily preserving the exact numerical color values. In this case though, I'm not particularly concerned with differences in perceived color between devices. I just want the color to match exactly between the launch screen and Metal.


I've tried a number of other profiles (Device RGB, Generic RGB, etc.), but they all result in the actual rendered color values being different from those specified in Interface Builder. (This is on an iPad Mini 2 running 12.1.4.)


What I'm looking for is to be able to specify a background color for the launch screen storyboard in Interface Builder such that the exact numerical color values are preserved without alteration. Is there a way to do this? Is there a color profile option I've missed that simply conveys the color values exactly without modifying them?

Accepted Reply

You may need to fall back and use 'Static Launch Screen Images', instead. See: https://developer.apple.com/design/human-interface-guidelines/ios/icons-and-images/launch-screen/

Replies

I don't think colorspaces are honored for launch storyboards, which means you probably can't get the same color from a single set of RGB values.


If I'm right about that, I don't think there's much you can do about it, but maybe someone else has some ideas.

You may need to fall back and use 'Static Launch Screen Images', instead. See: https://developer.apple.com/design/human-interface-guidelines/ios/icons-and-images/launch-screen/

Thanks for the reply. I suspect color spaces are honored for storyboards, based on the fact that choosing different color profiles leads to different color values in screenshots of the launch screen and to different values for the UIView 'backgroundColor' field. I suppose it may be the case though that there's no color profile selection you can make in Interface Builder that will guarantee preservation of specific RGB values.

If you specify a color in the "sRGB" colorspace in the storyboard, that should match a color created with the normal UIColor RGB creation methods, I think. That did seem to make a difference for me. Can always manually edit the storyboard to use colorSpace="custom" customColorSpace="sRGB" for the color, if setting it using IB's UI doesn't seem to work.