Color interpolation between 3 colors
I use the following equation to get a nice color gradient from colorA to colorB, but I have no idea how to do the same for 3 colors, so the gradient goes from colorA to colorB to colorC colorT = colorA * p + colorB * (1.0 - p); where "p" is the a percentage from 0.0 to 1.0 Thanks Well, for 3 colors, you can just to the same with p = 0.0 to 2.0: if p <= 1.0 colorT = colorA * p + colorB * (1.0 - p); else colorT = colorB * (p - 1.0) + colorC * (2.0 - p); Or scale it so you can still use p = 0.0 to 1.0: if p <= 0.5 colorT = colorA * p * 2.0 + colorB * (0.5 - p) * 2.0; else colorT = colorB * (p - 0