Ligands connected to a metal center forms a coordination complex. The color for a specific coordination complex can be predicted using "Crystal Field Theory".
All d block metal salts undergo metal to ligand or ligand to metal charge transfer, which is adsorbed in the visible region. However, S and P block element salts like NaCl, KCl, CaCl2, MgCl2 etc are generally not colored.
The energy difference between d-oribitals lies in visible spectrum that why d-block elements are genrally coloured due to electronic transtion between these d-orbitals where as in the case s and p block element salts the energy required for electronic trasition is very high and it lies in u.v or x-ray region which we cant see. that is why they are colour less in visible region