Skip to main content

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

Python PyPI License Platform

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
  • 256+ Style Combinations — Every style × color combination: BOLD_RED, ITALIC_BLUE, UNDERLINE_BG_GREEN, etc.
  • Severity Helperserror(), success(), warning(), info() with colored prefixes
  • Auto-reset Helperstyled() applies styles and resets automatically
  • Convenience AliasesGRAY, BG_GRAY, BOLD_GRAY for 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 BOLD, RED, GREEN, BOLD_RED, RESET
from color_kiss.utils import styled, error, success 

# Manual color codes
print(f"{BOLD_RED}Error:{RESET} Something went wrong")

# Auto-reset helper
print(styled("Hello, World!", BOLD, GREEN))

# Pre-combined styles (no need to list multiple codes)
print(f"{BOLD_RED}Critical error!{RESET}")
print(f"{ITALIC_BLUE}Processing...{RESET}")

# 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_BLACKBRIGHT_WHITE Bright colors
GRAY BRIGHT_BLACK

Background Colors

Code Preview
BG_BLACKBG_WHITE Regular backgrounds
BG_BRIGHT_BLACKBG_BRIGHT_WHITE Bright backgrounds
BG_GRAY BG_BRIGHT_BLACK

Style × Color Combinations

Code Equivalent To
BOLD_RED \033[1;31m
ITALIC_BLUE \033[3;34m
UNDERLINE_GREEN \033[4;32m
BOLD_BG_YELLOW \033[1;43m
DIM_BRIGHT_CYAN \033[2;96m
... 256+ combinations All style × color × bg

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 (
    BOLD, RED, GREEN, YELLOW, 
    BG_YELLOW, BLACK, RESET,
    BOLD_RED, ITALIC_BLUE, UNDERLINE_GREEN,
)
from color_kiss.utils import (
    error, success, warning,
    info, styled
)

# Status messages
print(error("Connection refused"))
print(success("Server started on port 8080"))
print(warning("Disk space low"))
print(info("Processing 42 files..."))

# Highlighted warnings
print(styled(" WARNING: Unsaved changes! ", BG_YELLOW, BLACK, BOLD))

# Using combined styles
print(f"{BOLD_RED}[FATAL]{RESET} System crash detected")
print(f"{UNDERLINE_GREEN}Task completed{RESET}")

# Logging with severity prefixes
def log(level, msg):
    prefixes = {
        "ERROR": ERROR_PREFIX,
        "WARN": WARNING_PREFIX,
        "INFO": INFO_PREFIX,
    }
    print(f"{prefixes.get(level, '')} {msg}{RESET}")

🔧 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.

Why 256+ style combinations?

Instead of manually writing BOLD + RED every time, use BOLD_RED as a single constant. All combinations are auto-generated at import time — zero runtime overhead.

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 & style×color combinations
│   └── 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

color_kiss-0.3.0.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

color_kiss-0.3.0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file color_kiss-0.3.0.tar.gz.

File metadata

  • Download URL: color_kiss-0.3.0.tar.gz
  • Upload date:
  • Size: 7.1 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

Hashes for color_kiss-0.3.0.tar.gz
Algorithm Hash digest
SHA256 d09288fb453d37e04f6fd59f278dfeab3d13566a8db3d5c6779938e4b9f6d24d
MD5 643201fa9d89a141c8d909b3ec42fa7e
BLAKE2b-256 e6034e217ade86afbb3c37bc6b5299d55acd705f1844b3a78babf976bfdcd18a

See more details on using hashes here.

File details

Details for the file color_kiss-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: color_kiss-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 8.1 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

Hashes for color_kiss-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 65a1476f63b588aba17882ec4aea646cf4411bffb04692a8b935186e48aa6aa3
MD5 6b3c1d3ead359f6cfed7ae9815d87a97
BLAKE2b-256 b04f662564c54796c2ea2282d7dc9dd77baeb77b3f4df69e55c3f74b2c8f524a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page