Melanin's high refractive index (RI) and broadband absorption capability contribute to the pigment's ability to protect against ultraviolet radiation (UV). These optical properties also contribute to the vibrant structural colors seen in birds and many other animals and plants.
source https://phys.org/news/2020-11-ultraviolet-exposure-ability-synthetic-melanin.html