Change Color of Div background depending on dynamic data output

Greeting Bricks Community,

I know I may sound thick at first, but any help or suggestions would be greatly appreciated.

I am looking for a way to change the background color of a div, depending on the result of a product attribute in a product archive. Basically, think of a product line that has multiple different flavors. The flavors are displayed within a query loop within a product archive. I would like the different flavors to have coordinating background colors depending on whether it includes watermelon, cherry, or other flavors.

If you would like a little more insight into what I am looking for look at the different mood options in the archives here: Buy THCa Flower Online - THCa Buds | Mood

Thank you for any help you can provide.