On board the Beagle, Darwin keeps a series of notebooks, recording both his scientific observations and theories as well as his personal thoughts. In one passage he recalls John Edmonstone, describing how their intimate conversations revealed to him that this Black man was the intellectual equal to any other university instructor. In another passage he describes how slave owners have created their own theory of biology: by describing whites and blacks as having separate origins, they justify their crimes.
As we saw in Edinburgh, Darwin was not the only one to see why abolitionists needed a theory to explain how all humans could be descended from the same African origin: many of his professors said the same. But he was the first to think of natural selection. In humanity's origins in Africa, black skin might protect you from the fierce tropical sun. But if humans migrated to the far less sunny lands of Europe, there might be some slight advantage to lighter skin (we now know the answer: the body needs light to make vitamin D). Over thousands of years, each time a slightly lighter skin was born (perhaps by random mutation), it would have a slightly better chance of passing on those genes in Europe. The population would gradually change. Dawin saw that natural selection could work for for all of life, gradually adapting and mutating: evolution. In the same set of journals where he describes his abolitionist ideas, we find a sketch of the first evolutionary tree.