GUI slider controls sunlight color?

Hello, I'd like to ask how do I change the color of a light (sunlight) via a slider?

Say, I have a specific set of colors that I want the slider to change the light's color to when it reaches a certain value.

Example: At value 0, the color is light blue; at value 50, the color is orange; at value 100, the color is purple.

I came up with this script, but it doesn't seem to work; the color doesn't really change. If someone could point me in the right direction on how to work around this?

var lights : Light[];
var Sunlight : Light;
var SunColorSliderValue : float = 0.0;
var SunColors : Color[];
var guiSkin : GUISkin;
var toggleBoolSUN : boolean = true;
private var toggleRect = Rect(15, 20, 135, 45);

function OnGUI ()

{
GUILayout.BeginArea( Rect( 10, 410, 240, 180 ),GUI.skin.window);

    toggleBoolSUN = GUI.Toggle(toggleRect, toggleBoolSUN, "Sunlight", guiSkin.button);

    lights[0].enabled = toggleBoolSUN;

        if(toggleBoolSUN)
            {
            SunColorSliderValue = GUI.VerticalSlider(Rect(185,65,30,100), SunColorSliderValue, 0, 100);
            }
    Sunlight.color = SunColorSliderValue;

    if(SunColorSliderValue == 0)
        {
        Sunlight.color = SunColour[0];
        }
    if(SunColorSliderValue == 50)
        {
        Sunlight.color = SunColour[1];
        }
    if(SunColorSliderValue == 100)
        {
        Sunlight.color = SunColour[2];
        }
GUILayout.EndArea();
}

Thanks for the help! =)

If you want a smooth transition, look into the Color.Lerp function. http://unity3d.com/support/documentation/ScriptReference/Color.Lerp.html

 if (SunColorSliderValue < 50)
   Sunlight.color = Color.Lerp(SunColour[0], SunColour[1], SunColorSliderValue/50);
 else
   Sunlight.color = Color.Lerp(SunColour[1], SunColour[2], (SunColorSliderValue-50)/50);

I have some VRML utilities that include a sorta multi-interpolator that allows as many different colors as you want, two lines of code, I should publish them.

For the slider control, I am also not quite familiar. I previously studied something on the UI slider control, however, the C# tutorial for slider control make me feel so complicated. Don’t know if that kind of thing be helpful to you. The proper answer here offered me much insights. I picked up the courage to continue digging into the GUI slider.