Most important electronic part of the digital camera is the sensor. That replaced the regular photographic film that used to capture moments of the world. Digital Image Sensor consists of thousands of thousand photo sensitive cells that can convert the light in to electronic signals. Also the sensor can identify colors in separate color sensitive cells as well.
Let’s see how a digital single-lens reflex or SLR camera works. Digital SLR cameras capture images exactly it sees through the viewfinder. when the shutter is released, light entering through the lens is directed to a large high-resolution CMOS image sensor. There is a color filter arranged over the image sensor, so that each individual pixel corresponds with one of the colors red, green or blue. The light entered through the color filters detects by the sensor. The sensor generates an electric signal representing the brightness of each color.
The image data is then converted into digital signals of high-speed by reading each pixel line via two channels. The red, green and blue color signals are processed with high speed and precision by cannons high-performance digital image processor, which reproduces images with natural coloration. Then record them on a memory card.
Check this video to understand how that amazing gadget works.