Here is Hamza Yusuf Hanson explaining the association of the colour black with sin:
The Prophet stated "If the son of Adam sins, a black spot appears in the heart. And if the person repents, it is erased. But if he does not it continues to grow until the whole heart becomes pitch black".
(Incidentally this notion of associating the color black with sin is not racist in its origins. The attribution has been long used, even among black Africans who refer to a person who is wretched as "black-hearted". The Qur'an says about successful people on the Day of Judgement that their "faces become white" (3:106). This does not mean "white" as a hue of skin; rather it refers to light and brightness, which are spiritual descriptions not associated with actual color. A black person can have spiritual light in his face, and a white person can have darkness, and vice versa, depending on one's spiritual and moral condition). [p8. Purification of the Heart by Hamza Yusuf, Sandala, 2012]