UIColor comparison

前端 未结 5 448
[愿得一人]
[愿得一人] 2020-12-17 06:04

Given a UIColor, I need to determine if it is \"light\" or \"dark\". If I could access the hex value of the color, I could just check if it was greater than or less than a c

5条回答
  •  执笔经年
    2020-12-17 06:51

    UIColor (and CGColorRef) are generally described in RGB values. If you want to determine light or dark, you'll probably want to convert these values to something like Hue/Saturation/Brightness. But there are no built in functions like you are looking for.

提交回复
热议问题