Hair color is determined by the amount and type of pigment called melanin present in the hair follicles. Melanin is produced by specialized cells called melanocytes, which are located at the base of the hair follicles. There are two types of melanin: eumelanin, which is responsible for black and brown hair colors, and pheomelanin, which is responsible for red and blonde hair colors.
The production of melanin is influenced by genetic factors, specifically genes that control the activity of melanocytes. These genes determine the amount and type of melanin produced, which in turn determines the color of the hair. For black hair, a higher concentration of eumelanin is produced by the melanocytes.
Additionally, other factors such as age, hormones, and environmental factors can also affect hair color. As people age, the production of melanin may decrease, leading to graying or whitening of the hair. Hormonal changes during puberty, pregnancy, or certain medical conditions can also impact hair color.