The physical chemistry of dyeing