Hi Nico!
Thanks for reaching out to us! Let me help you with this topic.
First, please let me note that we are fairly limited in how much support we can give for custom coding. That said, we always like helping out and at least point users into the right direction as much possible.
The snippet in that thread won’t work for the filter bar, as the filter bar works with ajax requests. You will need a different approach to achieve that.
Let me point you to the following article that is of similar topic > https://theeventscalendar.com/knowledgebase/the-events-calendar-category-colors/
Let me know if any follow up questions.
Best,
Victor