Skip to main content

A simple and powerful terminal color library with RGB, HEX, and styles

Project description

mantis-colors

A simple, lightweight, and modern Python library for adding color and style to your terminal output.


Installation

pip install mantis-colors

Quick Start

from mantis_colors import fg, bg, style, init

# You can initialize with autoreset so you don't have to manually reset colors after every color change!
init(autoreset_enabled=True)

print(fg.red + "red color")
print(bg.blue + fg.white + "white text on blue background")
print(fg.hex("#ff6600") + style.bold + "bold orange text using HEX")

Features

Colors (Standard & True Color)

Mantis Colors supports standard ANSI colors, as well as RGB and HEX for 24-bit True Color support.

from mantis_colors import fg, bg

# Standard colors
print(fg.green + "success!")
print(fg.red + "error!")

# RGB Support
print(fg.rgb(255, 100, 0) + "RGB orange")
print(bg.rgb(0, 100, 255) + "RGB blue background")

# HEX Support (with or without #)
print(fg.hex("#ff6600") + "HEX orange")
print(bg.hex("0066ff") + "HEX blue background")

Text Styles

Apply common text decorations with ease.

from mantis_colors import style

print(style.bold + "Bold Text")
print(style.underline + "Underlined Text")
print(style.strikethrough + "Strikethrough")
print(style.bold + style.italic + "Bold and Italic")

Automatic Reset

Are you tired of manually adding reset every time? Use init() or autoreset() to handle it globally.

[!NOTE] When autoreset is enabled, use string concatenation (+) instead of commas (,) in print() to ensure colors apply correctly to the entire output.

from mantis_colors import init, fg, autoreset
autoreset()
print(fg.red + "Everything is reset after each print call automatically")

# or 
init(autoreset_enabled=True)
print(fg.red + "Everything is reset after each print call automatically")

Comparison

Feature mantis-colors colorama termcolor
RGB Support
HEX Support
Simple API
Auto-reset

License

MIT © Adyanth M

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

mantis_colors-0.1.1.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

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

mantis_colors-0.1.1-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file mantis_colors-0.1.1.tar.gz.

File metadata

  • Download URL: mantis_colors-0.1.1.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for mantis_colors-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8067c70d79f10f635405d3cac6fd6841e9a40f907f8a8c23f1cdfb75cdbd7b79
MD5 19340993910839dc8d3e51c5e815bfaa
BLAKE2b-256 b750c64309c80bc5b33e345826736b591b67a40b5585eaf506523fb523ba4e95

See more details on using hashes here.

File details

Details for the file mantis_colors-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: mantis_colors-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for mantis_colors-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 354b919e06499c53624683bf1b32fdd4daa499a5773276a67fb073f7d42abcc4
MD5 836cf8e4fbff6c7315126fadccfca86a
BLAKE2b-256 7fbf60da25bac4aa609563e71e9b45b2b2d7e3d8bda8d58605b2e22bbbdb7176

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