Hi Dan,
I would check out the enumClass widget. It allows you to add classes to elements based on an attribute
https://appstore.home.mendix.com/link/app/2641/