Traditionally, socks are recommended to be of a similar colour to the trousers, preferably in a slightly darker shade.
Having thought about it, this makes sense because it means that when the sock is exposed – when, for example, you have your legs crossed – the leg appears to end at the top of the shoe, not at the end of the trouser. Again, it is an aid to height. It makes your leg look longer, and so you taller.