A spectrograph can do that.
a spectograph
That's called - a prism.
A prism is a transparent object that bends light and disperses it into the colors of the rainbow through refraction.
When white light hits an object, the object absorbs certain colors of light and reflects others. The colors that are reflected off the object are what we perceive as the color of the object.
You see the colors of light that are reflected off the object. The colors you see depend on the wavelengths of light that the object reflects. For example, if an object reflects green light and absorbs all other colors, you will perceive the object as green.
reflect
White light contains the many colors you see. The illuminated object will absorb and reflect the light as its' materials see fit. A black object will absorb all colors. A white object reflects all colors. Everything else lies in between there somewhere.
A pattern of different colors of light coming from an object is known as a spectrum. This spectrum is produced when light interacts with the object and is separated into its different wavelengths, creating a range of colors.
If an object absorbs all the colors of light, it will appear to be black. It is the reflected part of the spectrum that gives an object its color.
a spectograph
A device that breaks light into colors and produces an image is a spectrophotometer or a spectrometer. These instruments measure the intensity of light as a function of its color or wavelength.
No, the color of an object is the color of light that it reflects, not the color it absorbs. When light shines on an object, the object absorbs some colors and reflects others. The reflected colors are what we see.