How to achieve images as such..?

I want to post a few codes to my social feeds in the format like this…

Does anyone know how to achieve this…???
Is there an online tool or utility.


Monospace with syntax highlighting?

Thanks for the replies @ArielLeslie and @Undigon
But what I was looking for was found here.