I have really weird problem with colors in interface builder. I set a color on one UI element, for example UIView, and then I want the same color on UIButton...but when I try to do so, colors are often different - I mean little bit different tone, not absolutely different color. How is this even possible ??? I've tried to use RGB sliders, and other sliders, also that color picker tool... Only thing that helps me sometimes is, when I create new UI element. Anybody had the same problem and knows what's going on ?
4 Answers
Interface Builder filters colors through your monitor's current color space by default. You can change this in Xcode4 IB by bringing up a Colors dialog, clicking the Sliders tab, then clicking the little dropdown button under the magnifying glass that looks like a color spectrum. This will bring up a list of available color spaces -- select Generic RGB and adjust the sliders as necessary to get the correct color.
See this question for more information, especially the comments on the accepted answer.
-
12Deserves way more up votes. This has been bugging me for literally *years*. – mxcl Nov 21 '12 at 14:37
-
Apple wants appearances to be uniform regardless of the hardware, so it adjusts views accordingly. This question provides a bit more detail http://stackoverflow.com/questions/14578759/wrong-color-in-interface-builder – rm -rf slash Jul 11 '13 at 23:09
-
If you want to copy RGB values from Photoshop exactly (without conversion between color spaces), this answer explains how: http://stackoverflow.com/a/14581553/539149 – Zack Morris Dec 03 '14 at 23:45
-
2When I change the color space it reverts back to sRGB when I move the sliders or input a value. – Bot Jul 01 '15 at 22:56
-
@Bot it seems to only revert back to sRGB when the hex value field becomes active, which if you're tabbing will be after tabbing off blue. So in order to keep Generic RGB just click the red or green field after setting blue. I figured this out by mousing over the color swatch in the bottom left, it will tell you the profile. – Code Baller Sep 22 '15 at 22:58
-
I've got Generic RGB selected by default but I'm still seeing a mismatch. – Can Poyrazoğlu Apr 25 '17 at 12:21
Unfortunately, fiddling with color spaces didn't work for me. What did work was editing the raw xml of the .xib (right click .xib, Open As > Source Code) and changing the RGB decimal values there.

- 812
- 1
- 8
- 22
The currently selected item in interface builder will be slightly different to its actual colour - it has a darkened mask applied to it to highlight the fact that it is selected. You need to click somewhere else in the window to unselect the item, it's real colour will then be shown. I've fallen into this trap myself.

- 118,105
- 32
- 252
- 268
-
no, no :) that's not it...of course I clicked somewhere else, I also ran the project, colors are different – Michael Sep 20 '11 at 17:12
-