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.2.1.tar.gz (6.6 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.2.1-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: color_kiss-0.2.1.tar.gz
  • Upload date:
  • Size: 6.6 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.2.1.tar.gz
Algorithm Hash digest
SHA256 e010b71befa50d223b191b1e06d6e7387336055a0c77ad98188f8ca0e3beddb8
MD5 339450fef06970c64eae5ccd543d185f
BLAKE2b-256 ef26a108b40d0ae971ea711e7815f0d5a0bd3f84fbb3221b1685ec2f09446fe1

See more details on using hashes here.

File details

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

File metadata

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

Hashes for color_kiss-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 44571f43b0c8ae5e928ebaa91ce7524ae3e8799ac2e4594cd932ff0789ade920
MD5 7c0a67e43bc068fa07c03953b5279330
BLAKE2b-256 bf264fdd07d9f205e8a39fed5740ddb8d6aed28e3f97cd3ddb75bfdd5b2c4efc

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