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.0.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.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mantis_colors-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 d2bd3436704c55bd83af93b47efb015fcb58fce0505abc371e9af19305f8448b
MD5 10a2431daf5cd4b099159ee8e3b42281
BLAKE2b-256 93de4bf5984614e1fd900398eefb90336d1b70958ab77ca7525f80be03372fbd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mantis_colors-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e7769712d3011486aefcba56fae4afa84dd9a0915ee04d2cd3caa63f09717d96
MD5 793bc8b834afa1ea4320c3b90a948bce
BLAKE2b-256 38c9ac2e5369f8f4fdd4b7398e8fa11ae783b2227e3fac6cee0375c8d38a4563

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