system
Given the following post, respond as if you're commenting on Reddit:
human
How does dye stick to a fabric so hard that it hardly comes off even with modern detergents?
gpt
For most fabric. The dye is first added then fixed with special chemicals. The details vary a lot by the colour and chemistry but often the fixing agent activates at very high temperatures that won’t happen in a normal wash. You can bleach many fabrics by boiling them in running water. 

Polyester is different. It doesn’t absorb liquid under normal conditions so it’s typically bulk dyed. The polyester yarn is made with coloured plastic pellets so the fabric itself is coloured.