Skip to main content

A small colorful module to change text colors in terminal

Project description

Chroma Console

Chroma console is a python package for adding color and style to terminal text output using ANSI escape codes.

  • if requests is installed this package updates automaticaly
  • some terminals still don't support ANSI escape

Installation

pip install chromaconsole

How styling works

This package works using ANSI escape codes


Functions

Click here to see all functions
#styling
Styling.disable()
Styling.enable()
Style.reset()
Style.bold()
Style.faint()
Style.italic()
Style.underlined()
Style.slow_blink()
Style.rapid_blink()
Style.reverse()
Style.hidden()
Style.strikethrough()
Style.doubly_underlined()
Style.normal_intensity()
Style.not_italic()
Style.not_underlined()
Style.not_blinking()
Style.proportional_spacing()
Style.not_reversed()
Style.reveal()
Style.not_strikethrough()
Style.not_proportional_spacing()
Style.overlined()
Style.not_overlined()
Style.minecraft(*args)

#coloring
Color.text(*args)
Color.text_gradient("text", color, color)
Color.default_text()
Color.background(*args)
Color.background_gradient("text", color, color)
Color.default_background()
Color.Text.black()
Color.Text.red()
Color.Text.green()
Color.Text.yellow()
Color.Text.blue()
Color.Text.magenta()
Color.Text.cyan()
Color.Text.white()
Color.Text.br_black()
Color.Text.br_red()
Color.Text.br_green()
Color.Text.br_yellow()
Color.Text.br_blue()
Color.Text.br_magenta()
Color.Text.br_cyan()
Color.Text.br_white()
Color.Background.black()
Color.Background.red()
Color.Background.green()
Color.Background.yellow()
Color.Background.blue()
Color.Background.magenta()
Color.Background.cyan()
Color.Background.white()
Color.Background.br_black()
Color.Background.br_red()
Color.Background.br_green()
Color.Background.br_yellow()
Color.Background.br_blue()
Color.Background.br_magenta()
Color.Background.br_cyan()
Color.Background.br_white()

#some other things (not finished)
Console.clr_scr_to_end()
Console.clr_scr_to_begin()
Console.clr_entire_scr()
Console.clr_line_to_end()
Console.clr_line_to_begin()
Console.clr_entire_line()
Console.scroll_up(int)
Console.scroll_down(int)
Console.bell()
Console.save_cursor()
Console.restore_cursor()
Console.switch_alt_scr()
Console.switch_orig_scr()
Console.show_cursor()
Console.hide_cursor()

Example usage

from chromaconsole import *

print(f"{Color.Text.red()}here is red colored text{Style.reset()}")
print(f"{Color.text(r, g, b)}here is RGB colored text{Style.reset()}")
print(f"{Color.background(r, g, b)}here is RGB colored background{Style.reset()}")

print(f"{Color.text('#rrggbb')}here is HEX colored text{Style.reset()}")
print(f"{Color.background('#rrggbb')}here is HEX colored background{Style.reset()}")

print(f"{Style.bold()}Bold {Style.reset()}")
print(f"{Style.italic()}Italic {Style.reset()}")
print(f"{Style.underlined()}Underlined {Style.reset()}")
print(f"{Style.strikethrough()}Strikethrough {Style.reset()}")

print(f"{Style.bold()}{Style.italic()}bold+italic {Style.reset()}")
print(f"{Style.minecraft('§','§ahello §4world§r')}")

.enable() and .disable():

After executing the Styling.disable() command, the system will no longer apply coloring and styling to the content. To re-enable these features, simply use the Styling.enable() command.

from chromaconsole import Styling
#disable the coloring and styling
Styling.disable()
print(f"{Color.text(r, g, b)}text without color and style{Style.reset()}")
Styling.enable()
print(f"{Color.text(r, g, b)}text with color and style{Style.reset()}")

console commands

This package works also in cmd directly using

C:\Users\user> chromaconsole    #this returns package version

crcon:

you can change color and style in terminal like color command but more advanced

C:\Users\user> crcon <params>

-c <r,g,b / ⵌrrggbb / (r,g,b)>   -# text color
-b <r,g,b / ⵌrrggbb / (r,g,b)>   -# background color
-B   -----------------------------# bold
-I   -----------------------------# italic
-U   -----------------------------# underline
-s   -----------------------------# slow blink
-r   -----------------------------# rapid blink
-R   -----------------------------# reverse
-H   -----------------------------# hidden
-S   -----------------------------# strikethrough
-D   -----------------------------# doubly underlined
-P   -----------------------------# proportional spacing
-O   -----------------------------# overlined
-X   -----------------------------# reset

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

chromaconsole-0.8.2.1.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

chromaconsole-0.8.2.1-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file chromaconsole-0.8.2.1.tar.gz.

File metadata

  • Download URL: chromaconsole-0.8.2.1.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.11

File hashes

Hashes for chromaconsole-0.8.2.1.tar.gz
Algorithm Hash digest
SHA256 50e49fc604832efe8f9cbd84adf73fbda8fa6bb12d6ad472c7dc71f23a4b4946
MD5 af517a0eb76bffc487ab3a9d4f74e77b
BLAKE2b-256 db1b1d1dbb79c5b1c4fbb7a36e4ef4902a4840fef34f7b32ec9b95c39fc8b0d2

See more details on using hashes here.

File details

Details for the file chromaconsole-0.8.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for chromaconsole-0.8.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b275c4fb7438282555a5cb7f59bfe9d08cb6ad14aa1f83367a53f3849cbd94b9
MD5 13707485f78a4e4e20541eafec1b400d
BLAKE2b-256 364ba506b35157be9a4dd223a94ae88487fad8af33b5018da96fc417fce7aa37

See more details on using hashes here.

Supported by

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