Channel recommendation improvements

This commit is contained in:
Ilya Laktyushin
2023-11-16 18:03:14 +04:00
parent c688b5ad5f
commit 17a203d6b5
3 changed files with 151 additions and 40 deletions

View File

@@ -172,6 +172,12 @@ public extension UIColor {
}
}
func contrastRatio(with other: UIColor) -> CGFloat {
let l1 = self.lightness
let l2 = other.lightness
return (max(l1, l2) + 0.05) / (min(l1, l2) + 0.05)
}
var brightness: CGFloat {
var hue: CGFloat = 0.0
var saturation: CGFloat = 0.0