Your socks should match your trousers
You can’t go wrong following this advice, as it serves to create a streamlined look with no unnecessary color contrast until the eyes meet the shoes. I personally like this rule as its rigidness leaves no room for interpretation and confusion.
However once you have a sense of your own personal style, feel free to break this rule. Doing so will introduce a wardrobe with a wide range of patterned and perhaps even lively colored socks that conservative dressers would avoid. I’m a bigger fan of coordinating my sock with neckties and shoes; although more difficult than the aforementioned rule of matching your trousers, the tradition of coordinating your shoes, socks, and neckwear has a 100 year history and can help liven up an otherwise dull outfit.