Exactly like the image taken by your cell phone is actually black and white, and the colors are only added when you view the image with a special software. Namely, every photosensitive sensor is exactly the same, and they only measure brightness, without color. However, the light gets filtered with red, green and blue filters before the light hits the sensor, so that different sensors get different color of light. But still the analogy stands. With telescopes you might filter the colors differently, or even acquire the different 'colors' at different times or locations, but the principle is the same as in your cell phone.
cheers.