How to Generate False Color Palette
What you're looking for is a color map. As its name implies, this process maps an input (single-component, or grayscale) value within a predetermined range to some other color based upon some mapping. The implementations I've seen typically use linear RGB interpolation between a number of control points specified throughout the allowed input range. The color map used in the image you showed is a pretty common one, starting with dark blue, then through cyan, green, yellow, orange, and ending with red. It is referred to as the jet colormap in MATLAB.

So, as an example, for an input intensity on the range $[0,1]$, you might have an RGB lookup table of:

0.0  -&gt; (0, 0, 128)    (dark blue)
0.25 -&gt; (0, 255, 0)    (green)
0.5  -&gt; (255, 255, 0)  (yellow)
0.75 -&gt; (255, 128, 0)  (orange)
1.0  -&gt; (255, 0, 0)    (red)


Then, if you wanted to map the value $0.2$ to a color, then you would linearly interpolate between the first two datapoints as follows:

color = 1 / 5 * (0, 0, 128) / 0.25 + 4 / 5 * (0, 255, 0)
      = (0, 204, 26)


which would yield a greenish cyan, as it's close to the green control point.