Like this post?
I would think that it would be best to dye it when it's clean. Like skin, when dirty the pores of your hairs become clogged with dirt, and thus I'd imagine the dye would not be absorbed into the pores as well.
'Fifteen hundred members of the legion were taken prisoner.
Fidel lashed his machine gun and ammunition belt to his back,
leaped over the ship's rail into the shark-infested waters of Nipe Bay,
and swam several miles back to the mainland.
He was the only legionnaire to escape.'