So, to obtain a true color image in astronomy, you have to take three (black & white) exposures, each one with a different color filter. Of course, this means taking three different images of the same object.

Here are 3 images of the eagle nebula each taken with a different color filter, blue, green, and red.

The computer records only the intensity of each image (black & white), and later colors each b&w image by the color of the filter used (shown on the far right).