What color space does UIColor use? Because I was wondering the colors which we use was getting from Figma or something else. Plus Our Figma file's color-space configuration is unmanaged, which means the color space depends on Designer's device display. Mostly it will be working on P3. So what if the hex code came from P3, can we use that value directly?
My opinion: Even HEX value has been depending on color-space implicitly.
It turns out it's actually it's own color space, with some colors shifted
To sum up:
What color space does UIColor use?
Both color space are used. The default is
extended sRGB can be addressed with
< 0.0 or
> 1.0 values but NOT by
p3 is supported via
initWithDisplayP3 , which can be parsed from an hex string and mapped to
Because I was wondering the colors which we use was getting from Figma or something else.Plus Our Figma file’s color-space configuration is unmanaged, which means the color space depends on Designer’s device display.Mostly it will be working on P3.
I guess we should ask the designers to decide if they want to use the extended gamut or not, and fix it once and for all.
So what if the hex code came from P3, can we use that value directly?
If it’s a P3 hex, you can use it with
initWithDisplayP3 if not, you need to use it with
init(red: green: blue:) .My recommended solution is to use a #colorLiteral and check the correct color space
Currently, Figma file depending on Unmanaged (mostly P3) highly.So all of the value are compatible with P3, it seems I should use init for P3 even hex string. In most cases miss-matched color space, the color will be shifted to darken and less saturate. My understanding is correct?