title: Color coding cells in a table based on the cell value using Jinja templates
body: <p>I have a simple flask app and need to display a table of values, with the cell backgrounds colour coded based on the cell value according to thresholds. I'm generating the table content as follows:</p>
  
  <pre><code>  {% block dashboard_table2 %}
        &lt;table&gt;
        {% for row in data %}
            {% for item in row %}
                &lt;td&gt;{{ item }}&lt;/td&gt;
            {% endfor %}
        &lt;/tr&gt;
        {% endfor %}
        &lt;/table&gt;
    {% endblock %}
  </code></pre>
  
  <p>I tried wrapping the values in style tags like this in Python but it didn't work:</p>
  
  <pre><code>  if int(value) &lt;= 10:
        value = '&lt;p style="background-color:Red"&gt;' + value + '&lt;/p&gt;'
  </code></pre>
  
  <p>I'm guessing the CSS for the page is overriding the style attribute. I also tried just setting the text color attribute instead of background-color but no dice. Any suggestions on a good way to do this? I'd like to have a concise way to specify threshold values that aren't hard-coded in the templates.</p>