It tries to balance color allocations between each player. So, if you have a higher percentage of blacks and your opponent has a higher percentage of whites, you will get white, your opponent black.
The site tries to move your average towards 50/50 over the long run, though short series of games may have strings of the same color.
When you start a new live or daily game on Chess.com how does the game pairing algorithm decide which colour you will be?
I seem to get randomly black or white. Maybe it is turn about, I am not sure.
Also do any players have a preference for Black?
I guess white has a small advantage in going first.