change color of a material

change color of an object and material in run time using script or in a game mode

// Red color:
    renderer.material.color = Color.red;
//Yellow color:
    renderer.material.color = Color.yellow;
// Blue color:
    renderer.material.color = Color.blue;
// Green color:
    renderer.material.color = Color.green;
// Black color:
    renderer.material.color = Color.black;
// Grey color:
    renderer.material.color = Color.grey;

Here you go. Attatch it to the object you want to change the color off.

     var window1 : Rect = Rect(10,20,300,300); 
     var color1 : Texture2D;
     var activeColor : Color;
     var cube1 : Renderer;

       function OnGUI()
       {
       window1 = GUI.Window(0,window1,domy,"picker");   
       }

   function domy()
   {
   GUI.Label(Rect(30,30,145,150),color1);
   }

   function Update()
   {
   var mouse1 = Input.mousePosition.x;
   var mouse2 = Input.mousePosition.y;
   mouse2 = Screen.height - mouse2+20;
   var rect = Rect(30,30,200,150);      
   if (rect.Contains(Vector3(mouse1,mouse2,Input.mousePosition.z)))       
   {
   var u = (mouse1 - 30) / 200;  // x --> u
   var v = (mouse2 - 30) / 150;  // y --> v
   activeColor = color1.GetPixelBilinear(u,v); 
   cube1.renderer.material.SetColor("_Color",activeColor);
   Debug.Log(activeColor);
   }

   }

this is the answer for my question when mouse is over a texture a color picker.i am putting the code so that others can use it