Drupal 8 + Twig background-color -field select
One way to do this is provide a field template for that field that just prints the value and no markup:

field--your-field-name.html.twig:

{% for item in items %}
  {{ item.content }}
{% endfor %}


Then in the main template, wherever you want to output that field value, you would have:

&lt;div class="{{ content.your_field_name|trim }}"&gt;Example&lt;/div&gt;


The result should be just the field value, with no whitespace, so "black" or "grey".