Why are HgO and CdS compounds colourful?

We know that the electron configuration in $3d$ orbitals of $\ce{Zn^2+}$, in $4d$ orbitals of $\ce{Cd^2+}$ and in $5d$ orbitals of $\ce{Hg^2+}$ ions are completely same.


Then why the compounds of $\ce{Hg(II)}$ and $\ce{Cd}$, such as $\ce{HgO}$, $\ce{CdS}$ radiate versatile colour where $\ce{ZnO}$, $\ce{ZnS}$ are white?




The band gap decreases as either electronegativity of the anion decreases (electronegativity of anion in CdS < CdTe , ZnS < ZnSe) or the overlap decreases (overlap in ZnS > CdS).


Also, note that colored compounds only result when 1.8 < Band gap < 3.0. Larger gaps give white/transparent & smaller gaps give a black colour to compounds.
(The band gap in ZnS is 3.54, the band gap in CdS is 2.45.)


 6