Many flowering plants have very colorful petals like the lily seen here. What is the main purpose of these colorful petals?

A) to protect the plant from predators
B) to capture sunlight for photosynthesis
C) to distract birds from eating the seeds
D) to attract insects that pollinate the flower