# Colorama: making ANSI escapes work on Windows terminals

> Colorama is a small Python library that converts ANSI escape sequences into Win32 console calls. It is a compatibility shim, not a styling framework, and the README says so plainly.

**tartley/colorama** — Simple cross-platform colored terminal text in Python

- Repository: https://github.com/tartley/colorama
- Stars: 3,795 · Forks: 286
- Language: Python
- License: BSD-3-Clause
- Published: 2026-09-23 · Updated: 2026-09-23 · Language: en
- Canonical page: https://hysenlabs.com/projects/tartley-colorama

## The problem Colorama solves: ANSI escapes that die on Windows consoles

Unix and macOS terminals have handled ANSI escape sequences for decades. A program prints a byte sequence such as \033[31m and the terminal changes color. Windows consoles did not do this, so the same bytes appear as literal noise in the output. Colorama's job is to close that gap from inside Python.

The README is explicit about scope. Colorama wraps stdout, strips the ANSI sequences it finds, and converts them into the appropriate win32 calls to modify terminal state. On other platforms it does nothing. That single sentence should frame every adoption decision: this is a compatibility layer for Windows, not a color API.

The intended audience follows from that. If you maintain a library that emits ANSI sequences and you want it to keep working when a Windows user runs it, Colorama is the piece that makes the sequences behave. The README notes this explicitly: existing applications or libraries that use ANSI sequences on Linux or Macs can work on Windows simply by calling colorama.just_fix_windows_console() since v0.4.6, or colorama.init() in all versions. The alternative is ansi.sys, which fixes all applications running in a terminal at once. Colorama targets the case where that is not easy, for example when your application has no installer.

## How just_fix_windows_console rewrites the stream

The mechanism has two branches, and which one runs depends on the Windows version and on where stdout and stderr point. On a recent Windows 10 or better, with stdout or stderr attached to a Windows console, the function flips the configuration switch that turns on Windows' built-in ANSI support. Nothing is wrapped; the console does the work.

On an older Windows, again with a console-attached stream, Colorama wraps sys.stdout or sys.stderr in a file object that intercepts ANSI escape sequences and issues the matching Win32 calls to emulate them. In every other circumstance it does nothing at all. Redirected streams are left alone, non-Windows platforms are left alone, and repeated calls are safe.

That safety property is the main difference from the older init() interface. The README states that init is not safe to call multiple times, because you can end up with multiple layers of wrapping and broken ANSI support. It also applies a heuristic on all platforms to guess whether the streams support ANSI and, if it thinks they do not, wraps them in a filter that strips escapes. The README calls that heuristic not particularly clever, which is a fair warning: if you write code that emits escapes unconditionally and rely on Colorama to decide, you are trusting a guess. deinit() restores stdout and stderr to their original values, and reinit() resumes Colorama more cheaply than a fresh init().

The library ships no runtime requirements beyond the standard library, and pyproject.toml declares requires-python >=3.9 with classifiers for CPython 3.9 through 3.13 and PyPy.

## Installing Colorama and printing colored text on Windows

The README gives two package-manager routes, pip and conda. Nothing else is needed, because requirements.txt in the repository is literally a comment reading none.

```bash
pip install colorama
# or
conda install -c anaconda colorama
```

The first real use is a two-line initialization followed by ordinary ANSI output. The README recommends this pattern for most users and notes that colorama >= 0.4.6 is the version to depend on.

```python
from colorama import just_fix_windows_console
just_fix_windows_console()
print('\033[31m' + 'some red text')
print('\033[39m')  # and reset to default color
```

On a Windows console the text should appear red rather than as escape characters. On Linux or macOS the call is a no-op and the terminal handles the escapes itself. If you prefer the constant shorthand, the README shows Fore, Back and Style used the same way.

```python
from colorama import Fore, Back, Style
print(Fore.RED + 'some red text')
print(Back.GREEN + 'and with a green background')
print(Style.RESET_ALL)
print('back to normal now')
```

One caveat belongs next to that snippet: the README states that on Windows Colorama does not support ANSI dim text, and Style.DIM renders the same as normal text. The screenshots in the repository are the documented evidence for that, comparing the same demo scripts under gnome-terminal and under Windows Command-Prompt.

## Where Colorama is the wrong tool

Colorama is not a color library. The README describes Fore, Back and Style as deliberately rudimentary, and the reason is architectural: their value is that they are plain ANSI constants that Colorama can translate. If you want 256-color palettes, truecolor, tables, progress bars or styled markup, you are outside the design. The README points to Termcolor, Blessings and Rich for generating colors and suggests using Colorama only for its Windows handling underneath one of them.

Dim text is a concrete, documented gap on Windows. So is the init() heuristic, which the maintainers describe as not particularly clever and which they say they do not plan to fix, for backwards compatibility. The old interface is supported indefinitely, but that is maintenance of an interface, not of its behavior. If your code depends on init() guessing correctly whether a stream supports ANSI, you are depending on something the project has chosen to freeze rather than improve.

There is also a category of problem Colorama cannot reach: applications that are not Python, or Python processes whose output you do not control. ansi.sys handles those at the terminal level. Colorama only helps where you can call into it from the process that prints.

## Colorama against Blessings and Rich

The comparison that matters is not feature count but where the ANSI handling lives. Colorama sits between your print statements and the Windows console, translating escape sequences that already exist. Blessings and Rich generate the escape sequences in the first place, from a higher-level API, and the README recommends both as companions rather than substitutes. Used together, Rich or Blessings decides what the output should look like and Colorama makes it survive on Windows.

Against ansi.sys the split is system-wide versus process-local. ansi.sys gives the same behavior to every application running in a terminal, which is the broader fix. Colorama is intended for situations where installing that is not easy, which usually means a Python package distributed without an installer or a machine you do not administer. If you control the Windows images your software runs on, the system-level route removes a dependency from your package; if you do not, Colorama is the one you can actually ship.

## Maintenance, release process and the BSD-3-Clause licence

The repository is not archived, and the last push was on 2026-05-13. The Makefile is a cheatsheet of the release path: build produces an sdist and wheel with python -m build, test-release runs ./test-release against the built artifacts, and release uploads with twine to the colorama repository. Tests run through python -m unittest discover -p *_test.py, and tox.ini is present at the top level. The build backend is hatchling, and the version is read dynamically from colorama/__init__.py, so a version bump is a source edit rather than a metadata edit.

For adopters, the upgrade cost is close to zero as long as you are on the modern entry point. The README's guidance is to depend on colorama >= 0.4.6 and use just_fix_windows_console, with the old init interface kept for backwards compatibility and explicitly not a target for fixes. That is a stable surface, but it also means bug reports against init behavior are unlikely to change anything.

The licence is BSD-3-Clause, declared both in pyproject.toml and in LICENSE.txt, and the Makefile header carries the same notice. That is a permissive licence, which matters if you vendor or redistribute the package, but the repository also links to an ENTERPRISE.md file offering Colorama for enterprise on Tidelift. Read that file if your organization wants commercial support terms; nothing in the README describes what those terms are.

## Conclusion

Adopt Colorama if you ship a Python CLI whose colored output already works on Linux and macOS and you need the same escape sequences to render on Windows consoles, especially when you cannot install ansi.sys. Do not adopt it as a styling library: the README describes Fore, Back and Style as deliberately rudimentary and points to Termcolor, Blessings or Rich for capable color generation. Before depending on it, confirm you are on colorama >= 0.4.6 and calling just_fix_windows_console, check that your target Windows version and stream type match the two documented branches, and remember that ANSI dim text is not supported on Windows.

## FAQ

### What is Colorama used for in Python?

It makes ANSI escape sequences for colored terminal text and cursor positioning work under Windows. On other platforms it does nothing.

### How do I install Colorama in Python?

The README gives two routes: pip install colorama, or conda install -c anaconda colorama. There are no requirements other than the standard library.

### How do I use Colorama in Python?

Most users should import just_fix_windows_console from colorama and call it, then print ANSI escape sequences or the Fore, Back and Style constants. The README recommends depending on colorama >= 0.4.6 for this entry point.

### Is Colorama still maintained?

The repository is not archived and the last push was on 2026-05-13. The README states that the older init interface will be supported indefinitely for backwards compatibility, but that issues with it are not planned to be fixed.

### How do I install Colorama on Windows?

Installation is the same as on any platform, pip install colorama or the conda package. The Windows-specific part is at runtime: just_fix_windows_console enables built-in ANSI support on recent Windows 10 or better, and wraps stdout or stderr on older versions.

## Sources

- [Issues](https://github.com/tartley/colorama/issues)
- [License: BSD-3-Clause](https://github.com/tartley/colorama/blob/master/LICENSE)
- [README](https://github.com/tartley/colorama/blob/master/README.md)
- [tartley/colorama on GitHub](https://github.com/tartley/colorama)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/tartley-colorama
