A number of third-party Python modules are mentioned on https://stackoverflow.com/questions/287871/print-in-terminal-with-colors but it's also easy to do on most platforms without any external dependencies by using ANSI escape codes:
https://en.wikipedia.org/wiki/ANSI_escape_code
Auto-detecting support for ANSI colors is pretty hard:
https://stackoverflow.com/questions/7445658/how-to-detect-if-the-console-does-support-ansi-escape-codes-in-python
and so it may not be worth it.
A number of third-party Python modules are mentioned on https:/ /stackoverflow. com/questions/ 287871/ print-in- terminal- with-colors but it's also easy to do on most platforms without any external dependencies by using ANSI escape codes:
https:/ /en.wikipedia. org/wiki/ ANSI_escape_ code
Auto-detecting support for ANSI colors is pretty hard:
https:/ /stackoverflow. com/questions/ 7445658/ how-to- detect- if-the- console- does-support- ansi-escape- codes-in- python
and so it may not be worth it.