Color is added to carpet in two basic ways. The fiber can be "solution dyed"m which means the color pigments are mixed in with the liquid polymers producing fiber strands that are colored all the way through - just like a carrot. Or, the carpet fibers are made first into white synthetic fibers, then topically dyed which leaves the color on the surface of the fibers - like a red radish. Since the color goes all the way the solution dyed fibers, any solution dyed carpeting will have a superior face and bleach resistance. This can be important if the room has a lot of sunlight coming through the windows and you are worried about fading.
For resilience (the ability to stand up to traffic), nylon is the best carpet fiber. But, nylon is inherently prone to staining which is why mos nylon carpets are coated with stain and soil resistant treatments that may need to be replaced eventually after repeated cleanings.