Vitamin B12 deficiency has been linked with melasma , a different type of hyperpigmentation. However, sun spots are specifically linked to UV exposure from the sun rather than a vitamin deficiency.