codeandtheory / YCoreUI

Core components for iOS and tvOS to accelerate building user interfaces in code.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Clamp rgb channel values to {0...1} (i.e. 0x00 – 0xFF) when displaying as hex string

mpospese opened this issue · comments

Because we support extended RGB color space, individual channels can have values less than zero or greater than one. These do not format well for hexadecimal strings. For UIColor.rgbDisplayString we should clamp the channel values to {0...1} to avoid issues (and maybe append a ⚠️ emoji to the end of the string to indicate that its actual value is outside the bounds of the sRGB color space).