Using HSV to build a traffic light
A small tip for anyone working on some sort of data visualization. If you have values that lie between 0.0 and 1.0 (or 0% and 100%, or $some_value and $some_other_value), you can use a simple interpolation in the HSV (or HSB) color space to get a nice "traffic light" range of colors from red to green via yellow in the middle, which is fine for displaying something that is "OK" if the values are low and gets "critical" or "dangerous" for higher values (or vice versa). Just set the saturation and value (or brightness) parameters to 100% and use your data to vary the hue between 0° (which means red) and 120° (which is green). Since yellow sits right in the middle of that scale at 60° this gives you a smooth transition from red to yellow to green, which may look like this:
Now this might be common knowledge, but I just stumbled upon it some time ago and thought it was a useful tidbit that I wanted to share.