In my experience it is best to not try to dye your hair if it has not been washed within the last 48 hrs., especially if you sweat a lot, because dirt etc tends to cling to oily or sweaty hair which causes the dye to not work properly. It is the same with hair that has product like gel or hair spray in it. You could try it but I would not guarantee it would work. It would possibly come out splotchy.
Chat with our AI personalities