The best way to avoid these harmful chemicals is to buy brands that use 100% natural hair dyes. One needs to read the label carefully though, as some brands may still mix natural dyes with chemical preservatives and other chemical dyes for a faster and longer permanence.
You can also make your own using herbs and other products found at home. But this requires time and you may need to apply it frequently before achieving a darker shade of color.