Change the color of the background based on a range of values

Hello guys! I need some help to define a configuration to change the color of the card background based on a range of values. For example:

  1. The temperature is higher than 25 celsius degrees: red
  2. The temperature range is between 15 and 25 degrees: orange
  3. The temperature is lower than 15 degrees: blue

The idea is to extend the same setup to humidity values as well, but based on percentages here:

  1. the humidity is below 40%: red
  2. the humidity range is between 41 and 70%: orange
  3. the humidity is higher than 70%: green

I am supposed to be simple do that using button-card for different conditions based on states. But what about values? Could anyone give me some assistance, pls?