Gh c# change sphere color

I have generate a list of spheres according to my planes. And now I want to assign different color to those spheres in term of their sequence, like I want the first one red, the last one to be blue, and all between in a gradient. How should I achieve that in C# gh.

My starting scripts:
var origins = new List();
for(int i = 0;i < planes.Count;i++)
{
origins.Add(planes[i].Origin);
}

//gen sphere
var sphere = new List<Sphere>();
for(int i = 1;i < planes.Count;i++)
{
  Sphere s = new Sphere(origins[i], r);
  sphere.Add(s);
}

Only if you display objects through C# component or output a list of colors System.Drawing.Color.FromArgb() and use standard preview component.
Geometry types do not have color option except of mesh vertex colors, so all the preview stuff goes through preview methods.

If you want to display geometry through C# component, there is example in display

And here is example how to display colored points, spheres would be similar:

3 Likes