Add colored output to a Python CLI tool so the colors display correctly on Windows, macOS, and Linux without platform-specific code.
Use Colorama as a Windows compatibility layer alongside Rich or Termcolor so their colored output works for all users.
Highlight error messages or warnings in a Python script using colored text that works on every major operating system.
Install with pip, no dependencies beyond Python's standard library, just call init() once at startup.
Colorama is a small Python library that makes colored terminal text work on Windows. On Linux and macOS, terminals have long supported a standard way to produce colored output by embedding special sequences of characters in printed text. Windows terminals historically did not understand these sequences, so any Python program that used them would print unreadable symbols on Windows instead of colored text. Colorama solves this problem by intercepting those sequences and translating them into the Windows-specific calls that actually change text color. From a developer's perspective, using Colorama involves calling one initialization function at the start of your program. After that, you can use standard color constants like Fore.RED or Back.GREEN in your print statements, and the output looks correct on all platforms without writing separate code for Windows and other systems. Colorama also works alongside other popular color libraries such as Termcolor or Rich, acting as the Windows compatibility layer while those libraries handle the richer set of formatting options. The library has no dependencies beyond Python's standard library and installs with a single pip command. It is tested on CPython 3.9 through 3.13 and PyPy. The README explicitly states that Colorama's scope is intentionally narrow: it converts ANSI escape sequences to Windows API calls and does not aim to become a full-featured color generation library. New features adding color generation shortcuts are outside the stated scope of the project. Colorama is widely used across the Python ecosystem. Many CLI tools and developer utilities include it as a dependency to ensure their colored output works for Windows users without any extra steps on the user's part.
← tartley on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.