- Home /
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 :/
Cheers
Answer by landon912 · Oct 03, 2015 at 08:14 PM
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.
Answer by hexagonius · Oct 03, 2015 at 04:05 PM
add
new Color(1,1,1,1)
as an example for white, full opaque to the list of colors in the array definition.
Answer by zyonneo · Jan 01, 2020 at 12:55 PM
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.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Failed setting triangles in my mesh 1 Answer
Vector3 resultant array sorting 2 Answers