{% if
    tags is defined and
    tags[0]|length > 0
%}
    <style type="text/css">
{#    .html_formatter#}
    {# Here the order is very important! Highest priority topics LAST! #}
{#    {% set color_index = 0 %}#}
{#    {% set default_color_index = -1 %}#}
{##}
{#    {% for tag_data in tags[0].itervalues() %}#}
        {# Get a color to use. #}
{#        {% set the_color = colors[default_color_index] %}#}
{#        {% if color_index < colors|length - 1 %}#}
{#            {% set the_color = colors[color_index] %}#}
{#            {% set color_index = color_index + 1 %}#}
{#        {% endif %}#}
        {#  Write the HTML output. #}
{#        .html_formatter.{{ tag_data["key"] }},#}
{#        .html_formatter.{{ tag_data["key"] }} > span.{{ tag_data["key"] }} {#}
{#            background-color: {{ the_color }};#}
            padding: 2px 4px; margin: -2px -4px; border-radius: 4px; color: #fff; box-shadow: 0 0 0 1px  rgba(0,0,0,0.35), 0 1px 2px  rgba(0,0,0,0.65); text-shadow: 0 1px 0 rgba(0,0,0,0.35), 0 -1px 0 rgba(0,0,0,0.35), -1px 0 0  rgba(0,0,0,0.35), 1px 0 0   rgba(0,0,0,0.35), 0 1px 2px rgba(0,0,0,0.65); -webkit-transition-property: background-color, color; -webkit-transition-duration: 0.25s; -webkit-transition-timing-function: ease-in-out;
{#        }#}
{##}
{#        .topic_model_line_graph polyline.{{ tag_data["key"] }} {#}
{#            stroke: {{ the_color }};#}
{#        }#}
{#    {% endfor %}#}
    </style>
{% endif %}
