title: Thymeleaf iterate list with alternate colors
body: <p>In my Spring Boot project, I am iterating a Thymeleaf list like below:</p>
  <pre><code>&lt;div th:each=&quot;filename: ${files}&quot;&gt;
  &lt;div class=&quot;bold badge badge-primary&quot; th:text=&quot;${filename}&quot;&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  <p><strong>Question:</strong> I am clueless on how can assign badge-primary and badge-secondary (bootstrap4.5) classes to alternate list items while iterating through them?</p>
  <p>In simple words, first list item should have badge-primary class, second list item badge-secondary and so on.</p>
  <p>Is it possible? If yes, then how? Thanks.</p>