Putting RGB Colours into an Array? C#

Hi dudes!

I’m currently using this array to store colours into, however, how can i have custom colours such as RGBA?

 Color[] colors = {Color.green,Color.red, Color.white, Color.blue, Color.yellow, Color.black}; 

i’ve tried a number of things but i always get errors :confused:


Color colors = { new Color(0,1,0,1), new Color(1,0,0,1), new Color(1,1,1,1), new Color(0,0,1,1), new Color(1,1,0,1), new Color(0, 0, 0, 1)};

That is your existing array translated into their explicit form. Following this suit you will be able to mix your own colors.


new Color(1,1,1,1)

as an example for white, full opaque to the list of colors in the array definition.

From landon912 answer we can also use Color32

 Color[] colors = { new Color32(229, 204, 61, 255), new Color32(236, 159, 33, 255), new Color32(156, 190, 15, 255), new Color32(231, 134, 157, 255) };

We can select a color from the palette RGB Values.