All color, not just the color of chemicals, is due to the absorption and reflection of visible light. White light comprises a mix of lights of different wavelengths and therefore different colors. When light hits a material one of four things happens: it is entirely absorbed; it is entirely reflected; it is partially absorbed; or it it neither absorbed nor reflected. When all light is absorbed none is reflected, so the material appears to be black; conversely, when all of the light is reflected the material appears as white. When certain wavelengths are absorbed the observer only sees what is reflected. A material that is red absorbs all other wavelengths apart from red. A material such as glass or water appears colorless because it neither absorbs nor reflects white light.
Transition metals can form compounds of different colors because their outermost, d-orbital electrons can have different configurations. Copper(II) ions absorb every color but blue, which is why copper(II) sulfate has a distinctive blue color. This blue color is created by electrons absorbing light energy and moving from one d-orbital to another. Reducing copper(II) to copper(I) alters this configuration, which is why copper(I) sulfate is red.
Change in color can be used to detect reactions where both the start and end products are colorless. However, this requires the use of an indicator. An indicator is a type of dye which changes color according to its electron configuration. In the case of an acid-base reaction, this means it will be one color in acid solution and one color in basic solution. Hydrochloric acid reacted with an equal quantity of sodium hydroxide forms sodium chloride and water. The progress of this reaction can be monitored using an indicator called Universal Indicator, or UI. In hydrochloric acid UI is deep red and in sodium hydroxide it is deep purple. The mixing of these two compounds causes the UI to change color to green, implying the acid has been neutralized by the base, and vice versa.
Color change is also used to detect other types of reactions, typically in organic chemistry where reactants and products are often colorless. An example of this is the oxidation of an alcohol to an aldehyde or a ketone. Acidified potassium dichromate(VI) solution changes color from orange to green in the presence of an aldehyde but not in the presence of a ketone. Fehling's solution, which contains blue copper(II) complexed ions, is reduced to red copper(I) ions by aldehydes, but not by ketones.