Permanent hair dyes
Permanent hair dyes are mixed with an activator like hydrogen peroxide or even water to create oxidation.
Permanent colour molecules are much smaller than semi permanent or temporary colour dye molecules. Being an alkaline permanent colour opens up the cuticle scale layers of the hair allowing the tiny molecules to enter the cortex. These molecules then attach themselves to hydrogen peroxide to make much larger molecules thusly trapping themselves inside the hair cortex and no amount of washing will remove them as they are to big and cannot escape.
Meaning this dye would have to be cut/grown out or coloured over.
This process is called oxidation and is the basis for all permanent colours and can be potentially very harmful.
Semi permanent hair dye
Semi permanent hair colour will last longer than temporary colour and will fade with each wash but how long it lasts depends on many factors like coat type, how porous it is, colour of the hair etc.
Semi permanent colour molecules are much smaller than temporary colour molecules but bigger than permanent ones.
Being smaller it is easier for them to attach themselves to the hair cuticles and get a little deeper into the cortex with no help but with each washing a little colour will be removed and gradually lighten fading the semi permanent colour molecules.
Temporary hair colour
Most temporary hair colour can be washed out with one wash.
Temporary colour molecules are to large to enter the cuticle or cortex so will only stick to and coat the outside of the hair shaft making them very easy to wash away, BUT some colours /products can stain the hair because they only sit on the surface and it is possible they could transfer colour to other surfaces like furniture especially when wet.
Temporary colour products are things like chalk, blo pens, coloured hairspray, paint pens, glitter gel and airbrush ink.
Images showing how different dyes affect the hair.