To understand the answer, we'll have to know a little about how color and molecular structure are related. Light delivers energy in little packets called photons . Different colors of light pack different amounts of energy in their photons. For example, photons of violet light have almost double the energy of those of red light. Different molecules absorb different colors of light, depending on their electronic structure.
All materials absorb photons of some energy.
But only substances that absorb photons of visible light will have color. Molecules are very selective about what photon energies they will and will not absorb. In fact, the photon energies a molecule will absorb are so characteristic that they can be used as a 'fingerprint' to identify that molecule in a mixture. Quantum theory shows how quantized energies arise naturally from the wavelike behavior of confined electrons. The photon will be absorbed only if its energy is exactly what is needed to take the molecule from one allowed state to another.