Fix `final func toRGBAComponents()` on macOS for non-RGB colors
This commit is contained in:
parent
1e85f9461f
commit
04f7891d8c
|
@ -62,14 +62,11 @@ public extension DynamicColor {
|
|||
|
||||
return (r, g, b, a)
|
||||
#elseif os(OSX)
|
||||
if isEqual(DynamicColor.black) {
|
||||
return (0, 0, 0, 0)
|
||||
}
|
||||
else if isEqual(DynamicColor.white) {
|
||||
return (1, 1, 1, 1)
|
||||
guard let rgbaColor = self.usingColorSpace(.deviceRGB) else {
|
||||
fatalError("Could not convert color to RGBA.")
|
||||
}
|
||||
|
||||
getRed(&r, green: &g, blue: &b, alpha: &a)
|
||||
rgbaColor.getRed(&r, green: &g, blue: &b, alpha: &a)
|
||||
|
||||
return (r, g, b, a)
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue