Pressing_Keys_24_7
Pressing_Keys_24_7

Reputation: 1863

How to Adjust the Text Label Color According to the Background Image in Swift

I am using a lot of different background images in my project and I wanted to know how can I adjust the UITextLabel colour according to the Background Image View on my View Controller? i.e. if the background is dark the text will become .white whereas if the background is light the text will become .black. Any help will be highly appreciated:)

Upvotes: 0

Views: 844

Answers (1)

Amr
Amr

Reputation: 290

If you are okay with using third-party libraries, what I would suggest is to use https://cocoapods.org/pods/ChameleonFramework to get access to its function

ContrastColorOf(backgroundColor: UIColor, returnFlat: Bool)

Upvotes: 0

Related Questions