You can set the conditions in the dynamic class and based on that the color will be applied to the container.
Step 0: Create a Boolean variable for setting the color and use that in Step 3.
Step 1: Double-click on the container.
Step 2: Go to the Appearance tab, and go to the bottom of the tab, where you will find the Dynamic classes.
Step 3: Now click on Edit, and write your expression (if then ‘class-to-be-applied’ else ‘class-not-to-be-applied’)
Hope this answers your question.
Are you using a template grid? I can't quite make that out from the screenshot.
If so you should create a custom class for the templategrid which calls upon the “selected” subclass of the templategrid item and set the background to red for it.
There’s a learning path (intermediate) that could help
You can add an boolean attribute to the entity, on click set the value, and use it in dynamic class