Optical properties of ions in solids