Three colors gradient is not exactly new subject, but known solutions revolving around affine transformation of right triangle have this annoying problem: color interpolation is different on one edge. This problem vanishes if we use barycentric coordinates to interpolate color:

Check out this new shader and demo source (see also this post for bender-less implementation).

With this better method available, next question is exactly how much better is it. Following Nicolas’ example, I used random delaunay mesh with colored vertices to see how well would different triangles blend. It appears, however, that triangles edges are still easily noticeable, even though colors now match perfectly :( I guess this is unavoidable with independent triangle gradients. Well… something to think about later; two posts per night are more than enough.