Turmeric has a pigment known as xanthophylls, which lends the yellow colour to it. It also has a pigment called as carotene, which is reddish orange in colour.
When turmeric comes in contact with detergent, it reacts with the fatty acids present in the detergent and hence the carotene pigment gets more active than the xanthophylls and turmeric turns red.
When turmeric is combined with any base liquid like soap it turns red in colour while when turmeric comes in contact with any substance like that of vinegar, that is acidic in nature, it turns yellow. - - www.humantouchofchemistry.com/why-does-turmeric-turn-red.htm