Every CLI project eventually invents its own way to print "success" or "error." One module uses green text, another adds an emoji, a third does both differently. Output looks inconsistent, breaks in CI, and nobody notices until a log line leaks a password.
# before
print("\033[32mSuccess\033[0m")
# after
print(paint("Success", intent="success"))
RazTint defines a fixed mapping from intent (success, error, warning, …) to color and icon once, and every call site reuses that same mapping instead of picking its own.
Installation
Requires Python 3.10+.
pip install raztint
From source:
git clone https://github.com/razbuild/raztint.git
cd raztint
uv sync
Quick Start
from raztint import ok, paint
print(f"{ok()} File saved.")
print(paint("Connection failed.", color="red", icon="err"))
# intent sets color + icon together from one semantic name
print(paint("Deployment complete.", intent="success"))
# redact masks secrets before the string is printed
print(paint("password=1234", intent="debug", redact=True)) # password=****
Redaction on its own, without formatting:
from raztint import redact
print(redact("password=supersecret api_key=ghp_abc123"))
# password=**** api_key=****
More examples in Getting Started.
Preview
A simulated production log stream 9 secrets detected, 9 secrets redacted, 0 leaked to the terminal.
Features
- Intents: presets (
success,error,warning,debug, …) that separate meaning from styling paint(): one call for color, background, styles, and icons- Status icons:
ok(),err(),warn(),info(),pending(),debug(), each with the three-tier fallback - Redaction: pattern-based masking (
key=valuepairs likepassword=,api_key=,token=) applied as part of the formatting call, not a separate logging step; patterns are configurable, see Security & Redaction - Environment detection: Nerd Font → Unicode → ASCII, cached; configurable via
NO_COLOR,RAZTINT_FORCE_COLOR - Typed:
py.typed, full public API type hints - Advanced styling: raw 16-color, 256-color, and True Color support, plus bold, italic, underline, dim, and strikethrough when semantic intents aren't enough.
Documentation
| Guide | Description |
|---|---|
| Getting Started | Functional usage, paint(), and the tint instance |
| API Reference | Colors, styles, icons, and RazTint class methods |
| Intents | Semantic presets for common CLI messages |
| Security & Redaction | Masking tokens, credentials, and custom rules |
| Icons & Detection | Icon modes and environment/font/color detection logic |
| Configuration | Environment variables and runtime toggles |
| Development | Local setup, tests, and linting |
| Tutorial | Philosophy, detection walk-through, and best practices |
Example Scripts
| Script | Description |
|---|---|
examples/basic_usage.py |
Colors, styles, icons, intents, and redaction in one script |
examples/paint_demo.py |
Every color, style, and icon mode |
examples/real_world_cli.py |
Simulated file-processor CLI |
Design Philosophy
RazTint is built around a single idea:
[!NOTE] Make terminal output consistent, meaningful, and safe by default.
RazTint is not a terminal UI framework. It focuses on high-quality console messaging with:
- ANSI color support
- Semantic logging helpers
- Automatic icon fallbacks
- Secret masking
- Zero external dependencies
By keeping its scope intentionally small, RazTint stays predictable, dependency-free, and easy to drop into existing CLI projects.
Logging Integration Example
RazTint only returns a formatted string, it doesn't hook into logging or replace a handler. Pass that string to print(), a logger, or anything else that accepts a string.
import logging
from logging import Logger, getLogger
from raztint import paint
logging.basicConfig(level=logging.INFO, format="%(levelname)s: %(message)s")
logger: Logger = getLogger(__name__)
logger.info(paint("Database migration completed.", intent="success", icon=None))
logger.warning(paint("Disk usage above 90%.", intent="warning", icon=None, styles="dim"))
logger.error(
paint("Authentication failed for token=abc123", intent="error", redact=True, icon=None)
)
Known Limitations
- Python 3.10+ only.
- Font detection relies on OS tools (
fc-liston Linux,system_profileron macOS, PowerShell on Windows). SetRAZTINT_SKIP_SYSTEM_FONT_SCAN=1in sandboxed environments. - When
NO_COLORis set, all color output is suppressed regardless of other settings.
Contributing
PRs and issues are welcome. Open an issue first to discuss before starting work on a feature. See CONTRIBUTING.md for setup and guidelines.
License
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file raztint-0.9.0.tar.gz.
File metadata
- Download URL: raztint-0.9.0.tar.gz
- Upload date:
- Size: 14.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad0482eb473ac8fa70a490ac7b0473a507168f73c828a0f5c8b2ee193fe784e8
|
|
| MD5 |
0ba999ab149bdcf612822e69ae45c5dc
|
|
| BLAKE2b-256 |
ce7b727dffad1778a873a2253463ca1aaccb22df1391dee4311b03de2c776654
|
File details
Details for the file raztint-0.9.0-py3-none-any.whl.
File metadata
- Download URL: raztint-0.9.0-py3-none-any.whl
- Upload date:
- Size: 21.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3989490415decfd1ff0f57b4f904ab049f576cf94c3ab9213f796fe67fb0278b
|
|
| MD5 |
b964374bad23b44300cc8f570152db3d
|
|
| BLAKE2b-256 |
4e5d65b088e606129ac3737b6fbe6d351ff8c0a51ab6a78ce6d3dcdc9b3b945a
|