Different tags accent colors on one post


Let’s say I’m using two tags in a post; both have distinct colors.
Is there a way to display the accent color of each different tags in a single post?

My code works fine for the first tag in the list, however I’m struggling with the second tag.
What am I missing here?

<div class="primary-post-tag" style="--color:{{primary_tag.accent_color}}">
                <a href="{{primary_tag.url}}">{{primary_tag.name}}</a>
<div class="secondary-post-tag" style="--color:{{accent_color}}">
                {{tags from="2"}}

Thanks for your help.

Try using foreach to access the tag context:

    {{#foreach tags from="2" limit="1" }}
        <div class="secondary-post-tag" style="--color:{{accent_color}}">
            <a href="{{url absolute="true"}}">{{name}}</a>

Remove the limit if you want to show more than one secondary tag


That worked perfectly, thank you @Spiritix !