These are called melanocytes, and they produce the skin pigment melanin. The more melanin your skin has, the darker your skin color. The dermis contains your sweat glands, your hair follicles and all the blood vessels and nerves which service your skin. The dermis also contains oil glands which helps keep your skin moist. The Sun and Your Skin .
Sunshine contains ultraviolet light, which is the culprit in suntan, sunburn and skin cancer.
The ultraviolet light damages the DNA in the nucleus of the cells of your epidermis. The more melanin the melanocytes dump into your skin, the lower the risk for subsequent sunburn. But the tan resulting from melanin means that ultraviolet light has already caused damage. The damage is cumulative over your lifetime. By the time you're an adult, you already may have soaked up enough sunlight as a child to cause skin cancer.