More to it than just that. Blacks in northern climates who supplement their diet with vitamin D are under no selective constraints to have lighter skin. Similarly, whites in equatorial climates who wear covering and sun screen are also under no selective pressure to have darker skin.
But if there is another mechanism, other than evolution through natural selection of genetic variation, that explains why different human populations look differently and are locally adapted to environmental conditions - I would certainly like to hear it.
Each of Noah’s son’s looked differently. light, dark, yellow. They went off to different parts of the world after the flood.
It’s more than just vitamin d and sunlight I believe. One of the tidbits of trivia I’ve picked up in this lifetime is that during the Korean war, soldiers of African descent acquired frostbite injuries at a rate 4 times higher than soldiers of European descent.