Many astrophotos are captured using a monochrome camera and a variety of specialized glass filters so that the camera only captures very narrow bands of color. Different gases glow in a well known spectrum of distinct colors so you can choose a set of filters that capture the more common gases. The most common set is hydrogen, oxygen and sulfur.
The real fun starts with post processing when you as the scientist and/or artist get to decide how to color-map the data. You typically have three sets of monochrome data (hydrogen, oxygen and sulfur) and three basic colors (red, green and blue). But beyond the different combinations there are endless ways to mix and tweak the individual colors.
There is no right or wrong way. For me, I try to find a color combination that is both pleasing and provides a good color contrast between the different elements. I like to do all of my color mapping in Photoshop since I’m familiar with it and it lets me edit the colors visually.
And finally, here’s a short YouTube video showing how I do my color mapping in Photoshop