kailoon
kailoon

Reputation: 2069

UIView background color set is not what appears

I created a UIView with a set background color. Lets say RGB value 185, 45, 42. For some reason, when I take a screenshot of this view, it is not that color. It is a little bit darker. Is there a reason why UIView would do this?

The UIView background color is set in interface builder like this:

Color

When I run it on the simulator and take a screenshot and use the eye drop tool to determine the color, the numbers that show up are a little bit darker than what I entered. Same with a button.

I have other screens with the same red color and the screenshot I take of those, the red actually comes out correctly. I've been trying to determine what the difference is between those screens, but so far have not seen any. So I was just wondering if anyone would have any knowledge of anything that "could" case such a color change.

Upvotes: 2

Views: 1125

Answers (2)

matt
matt

Reputation: 535945

A common mistake when setting a color numerically in Interface Builder is to neglect the color space:

enter image description here

Different color spaces will give different colors (visually) for the same RGB values.

Upvotes: 8

John
John

Reputation: 545

When you set RGB color, you should notice that all the three color values range from 0 to 1, so give them a value greater than 1 would never work. Try this:

RGB(185 / 255.0, 45 / 255.0, 42 / 255.0)

Upvotes: 0

Related Questions