I've always been in awe of the images received by the Hubble telescope.
Then, too, I often wondered how those colours were generated.
Because curiosity is an asset (especially in old age), I checked it out and here's how it works:
The Hubble takes pictures in shades of grey only.
Each picture is captured through a filter which allows only certain wavelengths to pass.
When these greyscale pictures are transmitted to earth, technicians add the colours ... for public consumption.
For example, here are three such pictures:
The "photoshop" technicians change them to red, blue and green ... like so:
Then they superinmpose all three and get voila! Figure 1.
This superposition is what your TV set does ... with just Red, Green and Blue pixels. (Click!)
'course, them technicians are experts and cajole the superimposed composition into having the best possible appearance.