> vitamin D
That is the driving force for lighter skin (unless your diet is mostly fish, such as the Inuit). Skin gets darker again when migration towards sunnier climates happens: while UV light is essential for the synthesis of D3, it also destroys folic acid / vitamin B9 [1], which is essential when the neural tube of a fetus is being formed.
And since this mutation is so very visible, maybe here sexual selection plays a role, just like it is suspected with blond hair?
1: https://www.sciencedaily.com/releases/2014/03/140321095240.h...