Why are carrot red and spinach green?

Why are carrot red and spinach green?