How To Set UILabel Color In Swift Programmatically

Change the color of your label in code.

How To Set UILabel Color In Swift Programmatically

If you know your RGB values you can simply set the background color by doing:

label.textColor = UIColor(red: 1.00, green: 1.00, blue: 1.00, alpha: 1.00)

You can also convert a HEX color to UIColor by using these tools:

You can also use the standard UIColors such as:

label.textColor = UIColor.green

Here’s a full list of UIColors

If you liked this post and want to learn more, check out The Complete iOS Developer Bootcamp. Speed up your learning curve - hundreds of students have already joined. Thanks for reading!

Eddy Chung

I teach iOS development on ZeroToAppStore.com.

Similar Posts