But I don't suppose that is really what you were asking. Black is simply the colour we see when there is no light coming from the object we are looking at.
Light comes from the sun and the stars.
On the moon, it isn't. There, the sky looks black all the time, night or day. The difference is that the earth has a layer of air - the atmosphere. But the atmosphere is colourless, not blue. So this still doesn't explain why the sky is blue.