Get color of pixel at mouse click of a GUITexture

I was wondering how you would get the color of the pixel that the mouse click on a GUITexture

Here is a bit of code. Your texture must be marked as Read/Write enabled in the texture importer. Also The width and height in the Pixel Inset settings of the GUITexture must match the real width and height of the image:

#pragma strict
private var tex : Texture2D;
private var v3Corner : Vector3;

function Start () {
	var gt = GetComponent(GUITexture);                  
	tex = gt.texture;
	var v3Pos = Camera.main.ViewportToScreenPoint(transform.position);
	v3Corner = Vector3(v3Pos.x+gt.pixelInset.x, v3Pos.y+gt.pixelInset.y, 0.0);

function OnMouseDown() {
		var v3Pixel = Input.mousePosition - v3Corner;
		Debug.Log(tex.GetPixel(v3Pixel.x, v3Pixel.y));

you can download colorpicker from assetstore.