that depends...
the colour in most pictures is real, in the sense that it accurately reflects the spectra of the objects. they are the colours our eyes would see if they were millions of times more sensitive to light than they really are.
some images map different wavelengths to different visible colours, either for scintific or artistic effect. look up "wood effect" for a common (and beautiful) example.
emission nebulae are particularly troublesome. their light is mainly two wavelengths, a red one due to hydrogen, and a green one due to oxygen. if we see any colour at all we see green, bcuz that's the colour our eyes are most sensitive to.
the most commonly used colour films in the past weren't very sensitive to the particular shade of green, but were very sensitive to red. so emission nebulae photograph as red or pink, but are visually green. modern ccd imaging doesn't care either way, but many nebulae are photographed red to imitate the look of colour film.
ccd imagers, including those on hubble, are black and white devices. to take colour pictures you take individual exposures through colour filters, then add the colour in post-processing. digital cameras do this internally.