IOS-How to display gold color

I am trying to set the background color of my view to gold. I found RGB values ​​for several tones of this value. For this, I just do this:

[myView.backgroundColor=[UIColor colorWithRed:252.0 green:194.0 blue:0 alpha:1.0]]; 

But I get the same color as for yellow. The same can be said of silver color. I get the same color as for white. Is there a way to achieve this, or does iOS not support this?

+4
source share
4 answers

color values ​​are between 0 and 1.0f

 myView.backgroundColor=[UIColor colorWithRed:252.0/255.0 green:194.0/255.0 blue:0 alpha:1.0]; 
+12
source

UIColor accepts a percentage of color, from 0 to 1, instead of 0-255. Divide these RGB values ​​by 255.0 to get your desired color.

Link to UIColor

+5
source

The metallic appearance cannot be accurately expressed in solid color, because part of what the metal gives is its characteristic appearance - it is sheen . The same applies to fluorescence. If you are trying to simulate a metal surface, you need to simulate a metallic sheen.

+1
source

Gold is not an RGB color, gold reflects, which means that it reflects the color of everything else, but with a warm yellow color.

Look at a nice gradient of gold: Golden gradient on deviant art

0
source

Source: https://habr.com/ru/post/1400657/


All Articles