Why are all human beings not black in color?
First let's look at the difference between light skin and dark skin: darker skinned people have higher concentrations of melanin than those with lighter skin. Africa is located around the equator, a place where the sunlight is very intense. Melanin protects the skin against harsh, damaging rays, which is very beneficial in Africa. But a high concentration of melanin also decreases the skin's ability to produce vitamin D3 (1). Vitamin D3 is a vital nutrient to many physiological processes. Deficiencies in vitamin D3 has been known to cause things like rickets and osteomalacia (2).
So in Africa, having a high concentration of melanin in your skin conferred a great fitness benefit: you could go outside without getting cancer. But when humans relocated to places farther from the equator with reduced sunlight, having a high concentration of melanin in the skin actually became harmful because it would make darker skinned people more likely to have vitamin D3 deficiencies. Given this change in the fitness conferred by the trait of dark skin, individuals with lower concentrations of melanin in their skin were more likely to survive and reproduce in these new conditions. After many generations, the allele(s) that cause lighter skin became more common than those that cause darker skin.
Hope that was helpful!


T.L. Clemens, S.L. Henderson, J.S. Adams, M.F. Holick, INCREASED SKIN PIGMENT REDUCES THE CAPACITY OF SKIN TO SYNTHESISE VITAMIN D3, The Lancet, Volume 319, Issue 8263, 9 January 1982, Pages 74-76, ISSN 0140-6736, http://dx.doi.org/10.1016/S0140-6736(82)90214-8
http://www.everydayhealth.com/drugs/vitamin-d3