Created color box in dashboard

I want to choice box color in dashboard.

<div style="background-color: red; padding: 10px; margin: 0 auto; width:10px;">

This is my template.
I want to change background-color red to green.
When I got a data, I want to flexible to change red to green.
I used switch, but two color box in my dashboard.
Help me please.

read the info panel for ui_template.

For example:

<div layout="row" layout-align="space-between">
  <p>The number is</p>
  <font color="{{((msg.payload || 0) % 2 === 0) ? 'green' : 'red'}}">
    {{(msg.payload || 0) % 2 === 0 ? 'even' : 'odd'}}