Yes, exposure to sunlight is a major risk factor for melasma. Sunlight triggers melasma by stimulating the production of melanin, which causes dark patches on the skin. People with darker skin tones are more susceptible to developing melasma due to their higher levels of melanin.