GitHub and GitLab do not permit using colors in content in the repository preview view. This has been requested countless times, and the response is always to reject that request. (It's also beyond the scope of what Asciidoctor can control).
This is why I say that the repository preview view on GitHub and GitLab is not a publishing target. Rather, it's just a (low-fidelity) preview. If you want colors and other custom styling, you should process the content with Asciidoctor and publish it to GitHub Pages or GitLab Pages, respectively.