Apply gradient between two colors on x amount of objects

Hi,

I currently have a game like Stack where each block you place changes color.
The effect is some sort of rainbow right now (see image).

Code:

CurrentCube.GetComponent<MeshRenderer>().material.SetColor("_Color", Color.HSVToRGB((Level / 100f) % 1f, 1f, 1f));

But I would like the colors to go from one color to another.
For example from blue to green. What is the easiest way to get this working?

Use this to define two colors, then you can use the number of the block you are placing to lerp between. So if you wanted to lerp between Red and Green over 100 blocks, you could do something like

color = Color.Lerp(Color.Red, Color.Green, ((float)blockIndex)/100f)