I would like to randomly
choose 2 colors. But it has to be a random cold
color and a random warm
color.
I am using this extension
to take a random color :
extension UIColor {
static var random: UIColor {
return UIColor(red: .random(in: 0...1),
green: .random(in: 0...1),
blue: .random(in: 0...1),
alpha: 1.0)
}
}
According to this post, we can assume that :
if (B > R) {
color = cool
} else {
color = warm
}
How can I modify my random extension to be able to select random warm color or random cold color.
Any advices ?