Coloured Output to the Console with Colorama

Colorama makes it easy to output in colour, as we demonstrate in our quicksort example. We supply directions here for installation on Windows.

  1. Download the Colorama zip file from GitHub.
  2. Unzip to a convenient folder.
  3. Change the directory of the Command Prompt to that containing setup.py for Colorama.
  4. Type the command to install Colorama.

    We typed the command C:\Python33\python.exe setup.py install.

    The resulting installation log on the console began with these lines:
    running install
    running build
    running build_py
    creating build
    creating build\lib
    creating build\lib\colorama
  5. Use this script (adapted from the developer's instructions) to test the installation.
    from colorama import init, Fore, Back 
    init()
    print(Fore.RED + 'some red text')
    print(Back.GREEN + 'and with a green background')
    print(Fore.RESET + Back.RESET)
    print('back to normal now')
Programming - a skill for life!

Converting from Python to Pascal