Control time transition between colors


Please help, I have problems trying to fix this script…

I want to change the color of the material and I want to control the time of transitions between colors.

Now I can change the Color without problems, but now I want to smooth the transition between colors.

Please any advice is more than welcome.

var fadeSpeed : float = 7.5;
var NextColors : Color[];
var NextMaterial : int = 0;
function NextMaterialUsed()
    GetComponent.<Renderer>().material.color = Mathf.Lerp(GetComponent.<Renderer>().NextColors[NextMaterial],.material.color,Time.deltaTime * fadeSpeed);          
    if(NextMaterial < NextColors.length-1)
        NextMaterial += 1;
        NextMaterial = 0;

Check out this answer: