Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

all color change algorithm

Every second creating an object and I need to change the color of every next object by rainbow. I know how to change one`s color object, but I need an algorithm to do that right

I think its not good to handy make each color code every time

Color32 color = new Color(0.5f, 1f, 0.5f, 1f); // good

but I need for example 1st object 255,190,0, next 230,255,10, I mean color circle repeating. What should I do?

enter image description here

like image 334
Koma Avatar asked Sep 05 '26 10:09

Koma


1 Answers

In order to have the colors enumerated in a "rainbowish" sequence, you would need to cycle the hue in the HVS color model and convert to the RGB model to initialize the new object. Both models as well as the conversion are described in this Wikipedia article.

like image 183
Codor Avatar answered Sep 06 '26 22:09

Codor