The basic technique I use to do syntax highlighting for my talk slides has two steps:
I use this technique a lot when I'm preparing my talks! For an example of a whole presentation built with this technique you can check this slide deck.
To make it easier to follow, you can find here the step-by-step instructions. At the bottom of the page you'll also find an animated GIF showing you how I do this.





Pretty simple and saves you a LOT of trouble if you try to do syntax highlighting by hand... Which I did! It was painful. Finally, just because I can, here is the whole process in an animated GIF:

That's it for now! Stay tuned and I'll see you around!
Get ready for 12 intense days of problem-solving. The โAlgorithm Mastery Bootcampโ starts December 1st and it will feature 24 programming challenges, live analysis sessions, a supportive community of like-minded problem-solvers, and more! Join now and become the Python expert others can rely on.