How do I enter RGB values into Interface Builder?

IphoneCocoa TouchXcodeUser InterfaceInterface Builder

Iphone Problem Overview


How can I enter RGB or Hex color values for backgrounds in Interface Builder? I can select predefined colors but I would like to manually enter in RGB values. Where can I do this?

Iphone Solutions


Solution 1 - Iphone

How to choose a color by RGB in Interface Builder.

Click on the color slider icon, and then choose "RGB Sliders" from the drop-down list.

You can also use the magnifying-glass as a color picker to pick up an exact color from anywhere on the screen; also see @ken's excellent comment below clarifying how colorspaces work with the magnifying glass.

Solution 2 - Iphone

Although Tyler's response answers the question, you may encounter issues using the picker because it uses the display's colorspace (as clarified by Ken).

If you want to match RGB values between Photoshop and Xcode exactly (without conversion between colorspaces) then you need to save your images in generic RGB and enter any dropper values using the generic RGB colorspace.

  • When you choose "Save for Web & Devices" from Photoshop, uncheck the "Convert to sRGB" box.

enter image description here

  • In Xcode, click the colorspace popup in the color picker and choose "Generic RGB", then enter the red, green and blue values from Photoshop, NOT THE HEX VALUE as this reverts back to the sRGB colorspace for some reason (be careful not to tab to the hex field either, as that also changes the colorspace to sRGB).

enter image description here

More info here, including how to match screenshots.

Solution 3 - Iphone

It sounds like you're unfamiliar with the Mac OS X color panel. Click the tabs along the top of the color panel window to choose other pickers. Pickers are also plugins, so it's possible to add new UI for color selection. See, for example, developer color picker.

Solution 4 - Iphone

I know this is an old question, but I needed to find out the answer to this very same question today and it got me on the right track. The color picker from panic.com did install correctly but the hexadecimal option from the drop down menu in the color picker always sets it to RGB. So no good. Instead I found this:

http://wafflesoftware.net/hexpicker/

That shows the hexadecimal value and it works fully on Xcode 5.0.1 and Mavericks.

Solution 5 - Iphone

enter image description here

Check the above snap, in that go to Colors Tray, select the second button(RGB sliders(rectangle image) - which is placed next to circle on the top of the tray). In that you can enter RGB values.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSheehan AlamView Question on Stackoverflow
Solution 1 - IphoneTylerView Answer on Stackoverflow
Solution 2 - IphoneZack MorrisView Answer on Stackoverflow
Solution 3 - IphoneKenView Answer on Stackoverflow
Solution 4 - Iphoneuser1531352View Answer on Stackoverflow
Solution 5 - IphoneChandan Shetty SPView Answer on Stackoverflow