Hair colour is due to the presence of a pigment melanin. When more melanin is present then the hair color is dark while when less melanin is there the color is light.
Also, hair colour is a character which we get from our parents, so our hair color is similar to that of our parents.