Contour Rendering

I want to render a surface made up of several triangular facets accoring to the height information. In grey shade this is easy as all I do is to specify the intensity by factoring the height information. Thus going around each side I simply use the commands

glcolor3f height1fact,height1fact,height1fact
glvertex x1,y1,z1
glcolor3f height2
fact,height2fact,height2fact
glvertex x2,y2,z2
glcolor3f height3fact,height3fact,height3*fact
glvertex x3,y3,z3

Is there a way of altering the color index so that I can achieve a colour contour using the same principle as above. If I try to specify red for one vertex and then blue for the adjacent vertex, then I would like to control the transition colours in between.

a 1D texture works wonders for height based contour data.

Thanks for the info. I will try that tonight.