colored compounds of transition metals
Most compounds of the metals on the far left of the periodic table are white. Stir copper sulfate into water and you get blue; nickel salts are green; chromium can be orange, green or violet; cobalt swings from pink to deep blue. Why do the transition metals paint their solutions and crystals in such vivid colors while ordinary table salt stays colorless? The answer is one of the prettiest links between everyday color and the inner structure of an atom.
When a metal ion is surrounded by ligands (water molecules, ammonia, chloride and so on), the five d orbitals that were all the same energy in the free ion split into groups at slightly different energies. In a common octahedral arrangement, the two d orbitals pointing straight at the ligands (called the eg pair) are pushed up in energy, while the three pointing between the ligands (the t2g set) drop down. The gap between these levels happens to match the energy of visible light. So an electron can absorb a particular color of light and jump from the lower set to the upper set — this is a d-d transition. The compound then shows us the color that is left over, the complement of the light it swallowed: copper(II) absorbs in the orange-red and so looks blue. The size of the gap, and therefore the color, depends on which ligands are attached (their order of strength is the spectrochemical series), which is why swapping water for ammonia turns pale-blue copper deep royal blue.
This is the visible face of d electrons, and the reason a partly filled d shell is essential. An ion with an empty d shell (like Sc3+, d0) or a completely full one (like Zn2+ or Cu+, d10) has no room to make such a jump, so its compounds are white or colorless. Honest caveats: the colors are usually faint because the d-d jump is technically 'forbidden' by selection rules and only happens weakly, and crystal field theory's neat orbital splitting is a model — real bonds are part covalent, which ligand-field theory handles better. Some of the most intense transition-metal colors (like deep purple permanganate) are not d-d transitions at all but charge-transfer bands, where an electron leaps between metal and ligand.
The [Cu(H2O)6]2+ ion absorbs orange-red light through a d-d transition and so looks pale blue. Replace the water with ammonia to make [Cu(NH3)4(H2O)2]2+: ammonia is a stronger-field ligand, the d-orbital gap widens, the absorbed color shifts, and the solution deepens to royal blue — same copper, different ligand, different color.
We see the complement of the light absorbed; stronger-field ligands shift the gap and so shift the color.
A colored complex shows the color complementary to the light it absorbs, not the color of the light it absorbs. And the deepest, most intense colors are often charge-transfer bands, not weak d-d transitions — permanganate is purple from charge transfer even though Mn7+ has no d electrons at all.