Registry / type-stubs / types-colorama

types-colorama

JSON →
library0.4.15.20260508pypypi✓ verified 25d ago

types-colorama provides PEP 561 compliant type stubs for the colorama library, enabling static type checking for colored terminal output. It is part of the typeshed project and aims to provide accurate annotations for colorama==0.4.*. Updates are frequent as it's part of the typeshed project, which releases stub packages to PyPI automatically, sometimes daily.

pip install types-colorama
INSTALL
IMPORT
SIG · TYPES-COLORAMA
T
types-colorama
type-stubspythonv0.4.15.20260508
Install
1.5s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.4.15.20260508 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

init
from colorama_stubs import init
from colorama_stubs import init

This example demonstrates basic usage of the colorama library. The `types-colorama` package, once installed, allows type checkers like MyPy or Pyright to validate the types and signatures of `init`, `Fore`, `Back`, and `Style` when imported from `colorama`.

import sys from colorama import init, Fore, Style # Initialize Colorama. For Windows, this is essential for ANSI escape codes. # autoreset=True means that colors are automatically reset after each print statement. init(autoreset=True) print(Fore.RED + "This text is red!") print(Fore.GREEN + "This text is green and will reset.") print("This text is back to normal.") # You can also use Style.RESET_ALL explicitly for fine-grained control print(Fore.YELLOW + "Yellow text " + Style.BRIGHT + "and bright, then " + Style.RESET_ALL + "normal again.") # To verify type checking, you could run mypy on this file: # $ pip install mypy # $ mypy your_script_name.py
Debug
Known issues
gotchaThe `types-colorama` package aims to provide accurate type annotations for `colorama==0.4.*`. Using it with significantly different major or minor versions of the `colorama` runtime library may result in incorrect type checking errors or missed type issues due to API discrepancies.
fix
Always try to keep the installed `colorama` library version compatible with the `types-colorama` stub version. Review `types-colorama` release notes for targeted `colorama` versions.
affects: All versions
gotcha`types-colorama` is a stub-only package and provides no runtime functionality. It should not be imported or used directly in your application's code. Its sole purpose is to provide type hints for static analysis tools like MyPy or Pyright when you import and use the actual `colorama` library.
fix
Ensure your code imports directly from the `colorama` package (e.g., `from colorama import Fore`), not from `types_colorama`.
affects: All versions
gotchaFor `colorama` to function correctly and display colored output on Windows terminals, `colorama.init()` (or `colorama.just_fix_windows_console()` for `colorama >= 0.4.6`) must be called at the start of your program. While `types-colorama` will correctly type check these calls, its omission in your runtime code will lead to plain text output on Windows, not a type error.
fix
Include `from colorama import init; init()` or `from colorama import just_fix_windows_console; just_fix_windows_console()` in your application's entry point, particularly if targeting Windows.
affects: All versions of colorama, especially on Windows
gotchaStubs are maintained in the typeshed repository and released frequently. While this generally means up-to-date types, occasional breaking changes in type definitions may occur between stub package versions, even if the runtime library's API has not changed. This can cause your type checker to report new errors.
fix
To ensure stability in type checking results, consider pinning `types-colorama` to a specific version (e.g., `types-colorama==0.4.15.20260408`) in your project's dependencies.
affects: All versions
Upgrade
Version history
0.4.15.20260508latest on PyPI · released May 8, 2026
Audit
Dependencies
coloramarequiredRuntime library for which these are type stubs.
Agent activity
18 hits · last 30 days
node
16
OpenAI (training)
1
Resources
types-colorama — pip install types-colorama · libregistry