That’s a good question – I never thought about it before, but I’ve had a good read up on it and I’ll do my best to answer!
From what I can tell, both hair and eye colour is mainly influenced by a natural pigment called ‘melanin’, which is naturally a yellowish-brown colour (it’s the same pigment that gives you a tan in the sun!). If you have a lot of melanin in your hair or the irises of your eyes, you will have dark hair and eyes. This explains why usually people with brown or black hair have dark eye colour. People who have grey or blue eyes generally have little to no melanin in their irises, and will often have blonde or red hair.
The variations in eye colour are actually to do with really complicated effects that the shape and structure of the iris in your eye has on light when it hits it. It has a really fine and complex structure, meaning that there’s a lot of reflection, refraction and absorption of light happening at the surface of your iris. It’s the combination of all these effects that results in the differences in eye colour between people. To be honest, from what I can see it’s something we don’t fully understand yet!
There’s a really cool condition called ‘heterochromia’ that can arise in some people – it’s where both eyes are a difference colour!