Lets assume ,
cgcolor = Any_UIColor.cgColor
Now , how can I determine whether components
of cgcolor
is in RGB
or BGR
sequence ? (Number of components is 4)
Or, UIColor
will always be in R G B
format ?!
You can use colorSpace
property of CGColor
.
/* Return the color space associated with `color'. */
@available(iOS 2.0, *) public var colorSpace: CGColorSpace? { get }
Example:
let colorspace = UIColor.red.cgColor.colorSpace
CGColorSpaceModel
will give you the exact model of the color that you are using.
let colorspace = UIColor.red.cgColor.colorSpace?.model
Refer to https://developer.apple.com/documentation/coregraphics/cgcolorspacemodel