A lightweight, zero-dependency ANSI color library for terminal output — no bloat, just colors
Project description
color-kiss — A lightweight, zero-dependency ANSI color library for terminal output
No bloat, no dependencies — just ANSI escape codes and helper functions. Uses only Python's built-in string formatting.
✨ Features
- Zero Dependencies — Uses only Python standard library
- Full ANSI Spectrum — 8 regular + 8 bright foreground & background colors
- Text Styles — Bold, dim, italic, underline, blink, reverse, hidden, strikethrough
- Severity Helpers —
error(),success(),warning(),info()with colored prefixes - Auto-reset Helper —
styled()applies styles and resets automatically - Convenience Aliases —
GRAYandBG_GRAYfor readability
🚀 Quick Start
Installation
pip install color-kiss # pip
uv pip install color-kiss # uv
pipx install color-kiss # pipx
Usage
from color_kiss import styled, BOLD, RED, GREEN, error, success
# Manual color codes
print(f"{RED}Error:{RESET} Something went wrong")
# Auto-reset helper
print(styled("Hello, World!", BOLD, GREEN))
# Severity helpers
print(error("File not found"))
print(success("Download complete"))
📋 Reference
Text Styles
| Code | Effect |
|---|---|
BOLD |
Bold text |
DIM |
Dim text |
ITALIC |
Italic text |
UNDERLINE |
Underlined text |
BLINK |
Blinking text |
REVERSE |
Swapped fg/bg |
HIDDEN |
Hidden text |
STRIKETHROUGH |
Strikethrough text |
Foreground Colors
| Code | Preview |
|---|---|
BLACK, RED, GREEN |
Regular colors |
YELLOW, BLUE, MAGENTA |
Regular colors |
CYAN, WHITE |
Regular colors |
BRIGHT_BLACK–BRIGHT_WHITE |
Bright colors |
GRAY |
→ BRIGHT_BLACK |
Background Colors
| Code | Preview |
|---|---|
BG_BLACK–BG_WHITE |
Regular backgrounds |
BG_BRIGHT_BLACK–BG_BRIGHT_WHITE |
Bright backgrounds |
BG_GRAY |
→ BG_BRIGHT_BLACK |
Helper Functions
| Function | Description |
|---|---|
styled(text, *styles) |
Apply styles to text, auto-append RESET |
error(text) |
Error: {text} in red |
success(text) |
Success: {text} in green |
warning(text) |
Warning: {text} in yellow |
info(text) |
Info: {text} in cyan |
Severity Prefixes
| Prefix | Value |
|---|---|
ERROR_PREFIX |
Error: in red |
SUCCESS_PREFIX |
Success: in green |
WARNING_PREFIX |
Warning: in yellow |
INFO_PREFIX |
Info: in cyan |
📖 Examples
from color_kiss import styled, BOLD, RED, GREEN, YELLOW, BG_YELLOW, BLACK, error, success
# Status messages
print(error("Connection refused"))
print(success("Server started on port 8080"))
# Highlighted warnings
print(styled(" WARNING: Unsaved changes! ", BG_YELLOW, BLACK, BOLD))
# Logging
def log(level, msg):
colors = {"ERROR": (RED,), "WARN": (YELLOW,), "INFO": (GREEN,)}
print(styled(f"[{level}]", *colors.get(level, ())), msg)
🔧 Requirements
Python 3.0+ — no external dependencies.
❓ FAQ
Why another color library?
color-kiss is zero bytes beyond Python's stdlib — just string constants. Unlike rich (10+ deps) or colorama (Windows compat layer), it does one thing: ANSI escape codes.
Does this work on Windows?
Yes, on Windows Terminal, PowerShell 5.1+, ConEmu, and cmd.exe (Windows 10+). For legacy Windows, enable VT100 with os.system('').
What about 24-bit True Color?
Sticks to 16 standard ANSI colors (32 with backgrounds) supported by virtually all terminals. For 24-bit, use raw escapes: \033[38;2;255;100;0m.
📁 Project Structure
color-kiss/
├── color_kiss/
│ ├── __init__.py # ANSI constants
│ └── utils.py # Helpers: styled(), error(), success(), etc.
├── pyproject.toml
├── README.md
└── LICENSE
📄 License
MIT License — see LICENSE file.
Author: Fkernel653 Repository: github.com/Fkernel653/color-kiss PyPI: pypi.org/project/color-kiss
Project details
Release history Release notifications | RSS feed
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 color_kiss-0.1.9.tar.gz.
File metadata
- Download URL: color_kiss-0.1.9.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"CachyOS Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc0fe1d55d76a725283c3b0919139db36ffd0f22c689389c61d63a506873dcb9
|
|
| MD5 |
339e3c44b1b0655f7881f3db449a1b8a
|
|
| BLAKE2b-256 |
c993d84aed7aed9bf123c0557c9b8939ef66817ae1b165a3399273653101ff11
|
File details
Details for the file color_kiss-0.1.9-py3-none-any.whl.
File metadata
- Download URL: color_kiss-0.1.9-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"CachyOS Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b253e89a3d859041dbf206b2688242ad6d97ed1222387ff2e88319caf50ce32b
|
|
| MD5 |
c5b89e9ab895c758b98ca07611ef8b3c
|
|
| BLAKE2b-256 |
de8cf049a514231f443548cd366b50df5c18e4a5b9eb2e5b10a814fb560bbfdd
|