The slightly blue color of the water is due to its absorption of electromagnetic radiation in the visible light range corresponding to the red color (red light is absorbed by water about 100 times stronger than blue. The maximum of strong absorption falls on 760 nm and the arm of this band partially falls into the visible range (<700 nm). Two weak maxima at 605 and 660 nm are also present. Absorbed radiation causes transitions between oscillatory levels, and as a result strongly excited vibrations of atoms of water molecules. The occurrence of oscillatory absorption bands on the visible range is a unique feature of water and may be the only case of such a source of color of a substance. Other colored particles and atoms owe their color to the absorption of visible light by electrons  (color may also be the result of optical phenomena).
In the gaseous state, the water absorption bands are shifted towards visible light (higher frequency), and in the solid state towards infrared (lower frequency), which is due to weakening and strengthening of hydrogen interactions, respectively. Ice also shows blue in transmitted light, and its IR spectrum is similar to that of liquid water. The light passing through the snow has an especially intense blue color as a result of repeated scattering .
In heavy water (D2O), oscillatory vibrations are shifted significantly towards the infrared (760 nm band of water is located at about 1000 nm), as a result of which heavy water is colorless. This phenomenon is one of the proofs for the correct assignment of the water color of oscillatory absorption.