Background changes depending on the alarm in a given group/folder

Hello,
I want to change background on my factory layout depending on the alarm in a given group/folder.
For example: I have folder which contains tags related with MACHINE1. If there is an active alarm on one or more tags I want to change MACHINE1 background color on my factory layout.
How to do it?