How do I find the category an entry belongs to? I have a channel with entries which have a category field which is required.
When the entries are listed on a page how do I find the category that it belongs to?

{% for entry in entries %}
    &lt;span class="event"&gt;{{ entry.title }}&lt;/span&gt;
{% endfor %}


Code so far is above. 

The category has a background color field which I want to apply to the &lt;span&gt;.
If I'm following you, you've got a category group setup with a color field on its field layout.

Then you've got a category field setup with it's source set to that category group and in an entry, you want to get to the color field on the category group.

{% for entry in entries %}

    {# Grab the first category #}
    {% set category = entry.categoryFieldHandle.first() %}

    {# 
        Or if there are multiple categories...
        set category = entry.categoryFieldHandle.find()
        And loop through to find the one you want
    #}

    &lt;span class="event" style="background-color: {{ category.colorFieldHandle }}"&gt;{{ entry.title }}&lt;/span&gt;
{% endfor %}