It’s not clear how you want the colors to change exactly, but this example would change from red to green (with yellow in the middle) across the full range of the slider:
Col=thisComp.layer("100%").effect("Control Number")("Slider");
red=[1,0,0,1];
yellow=[1,1.5,0,1];
green=[0,1,0,1];
if (Col < 50)
linear (Col,0,50,red,yellow)
else
linear (Col,50,100,yellow,green)
Dan