Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add custom color in Xcode storyboard color picker?

Tags:

xcode

ios

I am planning to make theme color of UI elements in application. how we show custom color(Golden Color) like Black color in picker menu

enter image description here

is it possible? like we can add custom Property as shown in snapshoenter image description heret

like image 701
Saood Avatar asked Apr 07 '16 10:04

Saood


People also ask

How do I add custom colors to Xcode?

To create a color from our palette, we can do it directly by selecting the Assets. xcassets folder (or creating our own . xcassets folder for colors) in the project navigator (Project Navigator). Then we right click and select New Color Set.

How do I add a color palette in Xcode?

Click the gear and New to make a new custom color palette. You can name it whatever you want. Then click the plus (+) button to add a new color and name it. Use the color picker tool to set the color.

How do you add a custom color in Swift?

There are two ways to use your custom colors in Swift UI. Select your object in device preview. Choose “Color” under the attributes inspector. Your custom colors now show at the bottom of the list!

How do I change the background color in storyboard Xcode?

First let us see using storyboard, Open Main. storyboard and add one view to the View Controller. On the right pane you can see the property, and from there update the background color to color you want your view to be as show below.


3 Answers

You can add custom color as folow

  1. Select color property(Background color, text color, etc.). A popup is shown from that select "other" option.

enter image description here

  1. A color picker will be opened. Here you can set your custom color by RGB/Hex Code and you can set opacity.

enter image description here

The color will be applied and visible under "Recently Used Colors". This is how you can add custom colors but as far as I know you can't add colors in that default list.

like image 197
Mahendra Avatar answered Oct 09 '22 21:10

Mahendra


Create a new palette by clicking "New" here: enter image description here

A new palette "Unnamed" will be created. You can rename that palette by clicking the cog again and choosing "Rename..." Then, you'll need to click on the objects you want to capture the color of, and drag the color of those objects into the color chip area:

enter image description here

Once you've captured the color, you can even rename it something that indicates where it's normally used, providing more information to the recipient than just the color.

source

like image 34
SeNeO Avatar answered Oct 09 '22 19:10

SeNeO


As of Xcode 9 you can add colors to your asset catalog. Open your asset catalog, click the + and add a color set. Click on the color that was created and you can name it and set the color using the inspector. Thereafter that color shows up in storyboard color chooses in the area called Named Colors.

like image 45
Matt Avatar answered Oct 09 '22 20:10

Matt