The color of chemicals is a physical property of chemicals that in most cases comes from the excitation of electrons due to an absorption of energy performed by the chemical.
The study of chemical structure by means of energy absorption and release is generally referred to as spectroscopy.