How pigments actually function as colorants?
Consider natural indigo, formerly used to color blue jeans. It is insoluble; reduction converted it into water-soluble "indigo white". Fabric was soaked in indigo white solution; on air oxidation, it became insoluble blue indigo again, with indigo molecules now presumably mechanically entangled in the fiber and held by van der Waals forces. 

More often "binders" called mordants are used. They form an insoluble "lake" when they coordinate to the pigment; the lake can bind to fabric fibers. You can read more about the chemistry of the process here.