Blog Post #5: Colors 🔴 🟠 🟡 🟢

Published: 08/14/2021

This week was all about colors. The standard monochrome of the terminal seems somewhat boring, so to make the course more palatable I wanted to add different colors. An added benefit of colors is that it adds structure and heirarchy to the snippets. Different areas are highlighted differently making the whole thing easier to read and digest.

So the question is, how do we color text in the console? The way I did it was to use `colorama`, a python package that does just this. The syntax and API for colorama is fairly simple. One just has to add the colour they want to the print statement, so that is what I did. However, this wasn't working on command prompt. For some reason CMD was printing a weird code instead of the color.

So, I turned to my mentor to gain some insight as to what is going on. He recommended I use the init funtion in colorama. After doing so, it started working! The issue was with escape sequences. For some reason CMD can't handle them well enough and ends up printing them. The init function handles those errors.