Hair cells are called Melanocytes. They have branches sprouting off of them called dendrites; these are at the bottom of the hair follicle where the melanin (small colored pigments) is produced. When the dendrites lengthen the pigments are injected into the keratinocytes, this is the hair shaft being formed. The melanocytes only produce two types of melanin, and they are called Eumelanin and Phaeomelanin. Eumelanin looks like small pieces of rice and the colors are brownish red to black; generated by amino acid tyrosine. Phaeomelanin looks like forms of spots with the colors yellow to red; along with tyrosine phaeomelanin has cysteine which is rich sulphur. The amount of melanin determines what color the hair will be; For example black Japanese hair only has eumelanin while red Irish hair has a lot of phaeomelanin.
(http://www.hair-science.com/_int/_en/topic/topic_sousrub.aspx?tc=root-hair-science^amazingly-natural^color-palette&cur=color-palette)
To change the color of hair there are a few different ways. Natural colorants like Henna that stains the outer part of the hair and fades over time. Temporary colors are a direct dye that only coats the surface of the hair and washes out.
Semi-permanent colors will last through several shampoos. The color molecules in a semi