Why do parrots have colorful feathers?

Parrots are generally colorful because they
males want to attract ladies. Or because they somehow blend in with the foliage. This is not true in the case of the eclectus, but they are a special case.