Why are NaOH and Na2O and many other main group metal oxides WHITE when many do transition metal oxide species such as K2CrO4 (potassium chromate) are coloured- Yellow in this case.
Its all a matter of Charge Transfer
An Electron can jump from a group attached to the metal centre, onto the metal (and vice versa). This can ALWAYS happen by absorption of the appropriate amount of energy, even in species such as NaOH, but commonly the energy needed to do this is large so that the absorption occurs in the ultraviolet region and does not cause colour.
If the metal ion is fairly readily reduced and the group or groups attached (called LIGANDS) are fairly easy to oxidize (or vice versa) then an electron may jump from the ligand to the metal by absorbing energy in the visible region.