Change guitexture color based on it's current color

Hi
I’m trying use guitexures as toggle buttons changing their color make them bright and dull when on or off respectively. I’m doing this based on their current color but I can’t get the code to fire and I think the if statement is the problem when it checks for the current color.

here is my code:

Color onColor = new Color(128,128,128,128);
Color offColor = new Color(50,50,50,128);

    for(int i=0; i < Checks.Count; i++)
    			{
    				//Loop for all the toggle buttons
    				if(Checks*.HitTest(hitPos))*
  •  		{*
    
  •  				//Turn on track when dull*
    

_ if(Checks*.color == offColor && !pressed)_
_
{_
_
Debug.Log(“on”);_
_
pressed = true;_
_ Checks.color = onColor;
Tracks.active = true;
}
//Turn off track when bright*

if(Checks*.color == onColor && !pressed)
{
pressed = true;
Debug.Log(“off”);
Checks.color = offColor;
Tracks.active= false;
}
}*

The code doesn’t seems to fire for some reason._

I decided to do it with just changing tags at runtime it’ll do for now if I can’t solve getting it to change by it’s current color here’s the code for anyone interested:

//Loop for all the toggle buttons
for(int i=0; i < Checks.Count; i++)
			{
				if(Checks*.HitTest(hitPos))*
  •  		{*
    
  •  				//Turn on track when dull*
    

_ if(Checks*.tag == “off” && !pressed)_
_
{_
_
pressed = true;_
_ Checks.tag = “on”;
Checks.color = onColor;
Tracks.active = true;
}
//Turn off track when bright*

if(Checks*.tag == “on” && !pressed)
{
pressed = true;
Checks.tag = “off”;
Checks.color = offColor;
Tracks.active= false;
}
}
}*_