There were two connected reasons for this.
First, the white colour was generally seen to be better, as the colonialists were white and the Africans mostly black, and this feeling of superiority can be seen in the "white man's burden".
Second and connected to it, being lighter usually meant having partially European heritage, which the colonizers valued (often they were their own children).