0

I have a progress view and a UIView, setup with these values:

healthBar.trackTintColor = UIColor(red: 59/255, green: 153/255, blue: 252/255, alpha: 1.0)
link.backgroundColor = UIColor(red: 59/255, green: 153/255, blue: 252/255, alpha: 1.0)

However, the trackTint color is not the same as the view. It is slightly darker. Any reason for this?

james
  • 353
  • 3
  • 16
  • 1
    It's different because one is a tint and the other is the actual colour. Tint values are typically mixed with a lighter or darker shade depending on the component thats being tinted. – dlbuckley Oct 27 '16 at 09:36
  • Is it not possible to assign a color to the progress view instead of a tint? – james Oct 27 '16 at 09:54

1 Answers1

0

Assigning the same Color (RGB) as a tint does not gives the same output for original color, thats because:

In color theory, a tint is the mixture of a color with white, which increases lightness, and a shade is the mixture of a color with black, which reduces lightness.

You can find the full Wikipedia resource at this link.

How Can I solve it?

However, you CAN generate the appropriate matching for color and its tintColor, you might want to check these answers.

Hope this helped.

Community
  • 1
  • 1
Ahmad F
  • 30,560
  • 17
  • 97
  • 143
  • Well, now I know the reason I stoped trying to change the color! I assigned a transparent png to the track and placed a view behind the progress view with the color I wanted and constrained the progress view to it. Thanks. – james Oct 27 '16 at 10:01