Most hair follicles contain an oil gland called the sebaceous gland. This gland secretes oil into the follicle. The oil flows over the hair, lubricating it and keeping it soft. A muscle known as the arrector pili is attached to most hair follicles. In mammals with heavy coats, hair in this position traps air close to the animal's body, providing extra insulation against the cold.
Hair standing on end also makes an animal look larger and more dangerous.
When a human being is cold or frightened, the muscles contract and produce little bumps around the hair. The color of hair is determined largely by the amount and distribution of a brown-black pigment called melanin. Hair also contains a yellow-red pigment that is most visible in people whose hair has little melanin. Most people's hair gradually becomes gray or white as they grow older, because pigment no longer forms. The texture of hair depends largely on the shape of the hair, which can be seen in cross section under a microscope.