sty
String styling for your terminal
What it is and what it does
Sty is a zero-dependency library for styling terminal output with colors and text effects. It decouples styling markup from color palettes and terminal implementations, letting you write color codes once and swap renderers or palettes without changing your code. It supports 3/4bit, 8bit, and 24bit (RGB) colors, effects like bold and italic, and allows you to mute all styles globally. The library is fully typed, does not modify globals like some alternatives do, and provides high-performance access to styling rules.
You apply styles by concatenating string constants (fg.red, bg.blue, ef.bold) with your text, then reset with reset codes (fg.rs, bg.rs, rs.italic). You can also create custom color registers by subclassing the built-in register classes, or use the Register class directly to define your own styling rules.
Use it for:
- Add colored and bold output to CLI tools and scripts for better readability and user feedback.
- Create custom color palettes for logging or status messages without rewriting markup in your code.
- Build terminal applications that need RGB colors or effects across Unix, macOS, and modern Windows terminals.
- Mute all terminal styling globally for log files or non-interactive environments without code changes.
- Extend default color and effect registers with domain-specific styles (e.g., error red, success green).
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Sty provides a simple, customizable string styling markup for terminal output, supporting 3/4bit, 8bit, and 24bit colors plus effects like bold, italic, and underline, with no external dependencies.
Yes, if you need simple, zero-dependency terminal styling. Sty is lightweight, well-typed, and avoids global modifications that cause compatibility issues. The dormant maintenance status is not a blocker for stable use—the library is feature-complete and has no known vulnerabilities—but monitor the repository if you rely on it for new Python versions beyond 3.12.
Install
sty on PyPI
pip
pip install styuv
uv add stypoetry
poetry add styInstalling sty
Before you install
Low friction: pure Python wheel with zero runtime dependencies. Maintenance is dormant (last release November 2023, 991 days ago), but the repository remains active and unarchived with no recent breaking changes signaled.
License in practice
Apache-2.0 is permissive; you can use, modify, and distribute sty freely in commercial and open-source projects with minimal restrictions.
Quickstart
from sty import fg, bg, ef, rs
print(fg.red + 'Red text' + fg.rs)
print(bg.blue + 'Blue background' + bg.rs)
print(ef.bold + 'Bold text' + rs.bold)
Requires Python >=3.7,<4.0; legacy Windows terminal (cmd) may need a workaround for ANSI support.
Verify before relying
- Whether dormant maintenance (991 days since last release) poses a risk for future Python or terminal compatibility issues.
- Actual compatibility status with modern Windows terminals beyond the documented legacy cmd limitation.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.7,<4.0) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | dormant — 991 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 243,995/month — #8,767 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: sty-1.0.6-py3-none-any.whl
Keywords: styling, color, colour, terminal, ansi, command, line, cli
Tags
More Terminals packages
Wraps any iterable to display a real-time…
copyleft · top 100 on PyPI
richRich renders styled text, tables, progress…
permissive · top 100 on PyPI
coloramaColorama makes ANSI escape sequences for…
permissive · top 100 on PyPI
wcwidthMeasures the displayed width of Unicode strings…
permissive · top 1,000 on PyPI
ptyprocessRun a subprocess in a pseudo terminal (pty) and…
permissive · top 1,000 on PyPI
pexpectPexpect spawns and controls interactive console…
permissive · top 1,000 on PyPI
pastelPastel adds colored text output to terminal…
permissive · top 5,000 on PyPI
pystylePystyle provides terminal styling utilities for…
unclear · top 15,000 on PyPI
styleApplies ANSI color and text styling to terminal…
permissive · top 15,000 on PyPI
ansicolorsEmbeds ANSI color and style codes into Python…
permissive · top 5,000 on PyPI
simple-colorsAdds colored and styled text output to terminal…
unclear · top 15,000 on PyPI
colorfulColorful applies ANSI color and text styling to…
permissive · top 5,000 on PyPI
termcolorAdds ANSI color and text formatting (bold,…
permissive · top 1,000 on PyPI
terminaltexteffectsRenders animated visual effects for text…
permissive · top 15,000 on PyPI
ansiProvides ANSI escape codes for cursor movement…
permissive · top 15,000 on PyPI
cloupCloup extends Click with option groups,…
permissive · top 5,000 on PyPI