Hello! I have this code on my main app:
.onAppear {
var r: CGFloat = 0.0
var g: CGFloat = 0.0
var b: CGFloat = 0.0
var a: CGFloat = 0.0
UIColor(Color.accentColor).getRed(&r, green: &g, blue: &b, alpha: &a)
print("\(r), \(g), \(b), \(a)")
}
If I'm using "Color.red", the output is:
0.9999999403953552, 0.23137253522872925, 0.18823528289794922, 1.0
But, if I'm using Color.accentColor:
0.0, 0.4784314036369324, 0.9999999403953552, 1.0
Instead of:
0.3059999942779541, 0.16499999165534973, 0.5180000066757202, 1.0
Which is the one set on the Assets.xcassets.
It is not only Color.accentColor, but all the colors defined at the xcassets. For example, a color with any/dark appearances will always return the any components.
Details:
https://github.com/heltena/SwiftUI-GetComponents
Thanks!