Did you have a looked at the Polygon function?
For your triangles, instead of drawing the 3 lines you could draw the triangles with the Polygon function, and modulate their color in function of the altitude, for example the mean value of the three.
Best regards.