All perfect praise be to AllahThe Lord of The Worlds, and may His peace and blessings be upon our Prophet Mohammad and upon all his family and companions.
Hair dye is of two kinds:
First: Dye that creates no layer and doesn`t prevent water from reaching the hair, such as Hena and most types of dyes. It is permissible to use this type and ritual purity isn`t conditioned before using it.
Second: Dye that creates a layer and doesn`t prevent the water from reaching the hair. It isn`t a condition that this type should be applied while in a state of ritual purity. However, if the person is in a state of minor or major impurity. i.e. he must perform Ghusl (Ritual bath) or make Wudu` (Ritual ablution), then he/she should remove the dye first so as for the Ghusl and Wudu` to become valid. This is because ritual purity entails that water reaches every hair and part of skin.
Al-Imam Al-Nawawi said: "If he had, on parts of his body, wax, dough or Hena and the like, which prevented water from reaching a certain spot, then purity is invalid; whether they were of small or large quantity. If a trace or color of the Hena or any other dye remained, but didn`t prevent the water from reaching the skin and hair, then that person`s ritual purity is valid." {Al-majmou`, vol.1/pp.529}.
In terms of the dye types that prevent water from reaching the skin or hair, the people specialized in this field have the final say. And Allah The Almighty Knows Best.