Summary: Dyeing the hair is permitted in Islam as long as pure black is avoided. Dark shades are permitted.
Beginning of translated fatwa from IslamOnline
Question: Is it permissible for a man to dye his hair when it becomes gray? What about a woman?
It mentioned in a hadith of the Prophet [that he said]: “Whoever has hair should honor it.” (narrated by Abū Dawūd and supported by other narrations. Considered authentic by some scholars.) The ways in which hair can be “honored” are many. It applies to both men and women, each according to what fits their hair, such is combing, using oils, or dyeing in order to hide grayness.
Scholars in the past spoke of dyeing the hair using black dye and most of them forbad it. However, their evidence only applies to men and to cases of deception, such as when a woman dyes her hair black in order to appear younger so that men may want to marry her. As for a married woman whose age is already known by her husband, then there is no issue with her dyeing her hair according to whatever she and her husband like. Ibn al-Jawzī even permitted it for men.
What has been mentioned against dyeing relates to the issue of the seeking of glamour and lack of respect for the obedience toward God that an old person should show as a preparation for meeting their Lord.
Shams al-Dīn Abū ʿAbdallāh b. Mufliḥ al-Maqdisī al-Ḥanbalī (d. 762 AH [1360-1361 CE]), a student Ibn Taymīya, in his book Al-Ādāb al-Sharʿīya wa-l-Minaḥ al-Marʿīya:
The way of the Ḥanbalīs is to follow the tradition of changing gray hair. Regarding this there is the hadith in the Ṣaḥīḥayn [referring to Ṣaḥīh al-Bukhārī and Ṣaḥīh Muslim]: "The Jews and Christians do not dye their hair, so do otherwise than they do." It is recommended to use henna and katam [a substance used for dyeing hair a reddish black color], due to the Prophet doing so as is narrated by Aḥmad, Ibn Māja through reliable chains of transmitters, and due to the actions of Abū Bakr and ʿUmar whose authenticity is agreed upon.
It is disliked to dye hair black as there is a text from Aḥmad on it. He was asked: "Is it disliked to dye hair black?" He said: "Yes, by God, for the Prophet's saying as transmitted by the father of Abū Bakr: 'Avoid [dyeing] black.' (Narrated by Muslim).
The reason, as some jurists have mentioned, is that if an old person dyes their hair black they will be mutilating their appearance [or causing themselves to be like the young]. However Abū Isḥāq b. Rahawyh permitted it for a woman who does it to beauty herself for her husband. It is also not disliked for war [referring to camouflage?]. According to the Shāfiʿites: It is recommended for gray hair to be dyed yellow or red, but black is forbidden according to what they consider to be the most reliable opinion.
In addition to what is transmitted by the father of Abū Bakr, there is also this narration: “There will be in the End Days a people who will use black to dye their hair like the breasts of pigeons. They will not smell the scent of Paradise.” (Narrated by Abū Dawūd and al-Nasāʾī with a jayyid chain of transmitters [not “authentic”, but considered of relatively good quality])
End of translated fatwa
Source (Arabic PDF): IslamOnline
Second fatwa (not translated above) from IslamWay.
assalamu alaykum, i know it is forbidden to dye our hair pure black, but what about dark blue? so dark that it looks black from afar but you can see that it isnt when you look closer?
Alaikumassalam wa rahmatullah,
It is mentioned that the Companion Abu Bakr used a dye made of henna and something called katam (a reddish black dye). But since he mixed the two dyes, the result would not have been so dark as to appear black. As far as I know there is no text that deals specifically with extremely dark shades. The Maliki opinion and the opinion of Imam al-Ghazali (who was a Shafi`ite) is that it is disliked, but not forbidden, to use a black dye (whether male or female). Possibly the same would apply to very dark shades.
Due to the disagreements on this matter, it would be best to not use very dark shades.
Sources: Third fatwa from IslamWay