{% if value is not defined %}
    {% set value = field.value %}
{% endif %}
<span class="badge badge-{{ value.color is defined ? value.color : value.color }}">{{ value }}</span>