If instantiate prefab is selected how can i change the color?

I created a panel and inside i add Grid Layout. I Instantiate prefabs in this panel when start and add this prefabs onClick function with a method. I wanna change the color when prefab is selected but i dont know which is which. How do i do that?

public void basildi()
{
this.GetComponent<UnityEngine.UI.Image>().color=new Color(0,0,255);
}

ı wanna change the color when clon is selected. Inside this method.