A powerful python module to set console color
Project description
Recolor
Recolor is a powerful Python module that allows you to set console colors in your Python applications. With this module, you can add color and style to the text displayed on the terminal/command prompt.
This module was created by Hamidreza Ahmadi and is available on his GitHub page under the username zhmid. You can find the source code, documentation, and examples on his page.
Installation
To install Recolor, you can use pip:
pip install recolor
Usage
To use Recolor, you can import the module and use its functions as shown in the following example:
import recolor
print(recolor.colorize(255, [100],1) + "hi")
In this example, the colorize()
function is used to print "hi" in a specific color with a weight of 1. The fgcolor()
and bgcolor()
functions can also be used to set the foreground and background colors separately, and the uncolor()
function can be used to reset the console color to its default setting.
Functions
The following functions are available in the Recolor module:
colorize(fgcolor, bgcolor, weight=0)
: Returns the color code for a specific combination of foreground and background colors with a specified weight.fgcolor(fgcolor)
: Returns the color code for a specific foreground color.bgcolor(bgcolor)
: Returns the color code for a specific background color.uncolor()
: Resets the console color to its default setting.
Input Formats
The following functions are available in this module:
colorize
fgcolor
bgcolor
uncolor
colorize
The colorize
function takes three arguments: fgcolor
, bgcolor
, and weight
.
The fgcolor
and bgcolor
arguments specify the foreground and background colors for the output text, respectively. These arguments can be either RGB values or color names.
Accepted RGB values are arrays of three integers representing the red, green, and blue values for the desired color.
The weight
argument specifies the weight (or intensity) of the text. It should be an integer between 0 and 99, with higher values indicating bolder text. The default value is 0.
fgcolor
and bgcolor
These functions are simpler versions of colorize
. They each take one argument, which is the color for the foreground or background, respectively. The format of this argument is the same as for fgcolor
and bgcolor
in colorize
.
uncolor
The uncolor
function returns the escape code to reset the terminal color back to its default value.
colorize
fgcolor
bgcolor
uncolor
Predetermined color
These variables are values that you can call predefined colors by calling them inner colorize()
, fgcolor()
& bgcolor()
:
red = [205,0,0]
green = (0,205,0)
white = (255,255,255)
black = (0,0,0)
gray = (50,50,50)
blue = (0,0,205)
yellow = (255, 230, 0)
magenra = (255,0,255)
cyan = (0,255,255)
For more information on how to use these functions, please refer to the documentation on Hamidreza Ahmadi's GitHub page.
Conclusion
With Recolor, you can easily add color and style to the text displayed on the terminal/command prompt in your Python applications. This module is easy to use and highly customizable, making it a great choice for developers who want to create eye-catching console interfaces.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file Recolor-0.1.4.tar.gz
.
File metadata
- Download URL: Recolor-0.1.4.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43551e1f302b3a0c834f9b6f816c696f18bece6c557ad06ff285b8401f5a10ec |
|
MD5 | c859fa78aa8e0f3d11d413df607e5d47 |
|
BLAKE2b-256 | 55876cf1dc275cf7c82da07d290d26801dc6490218390f9eca3569f268d0b36d |
File details
Details for the file Recolor-0.1.4-py3-none-any.whl
.
File metadata
- Download URL: Recolor-0.1.4-py3-none-any.whl
- Upload date:
- Size: 2.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 751aa5247fc8e370a1f231d8e4d4a919cb7177248b80ac641a6721fa8e474065 |
|
MD5 | 1d3f3cc9f0ad5ba347c00946895972a7 |
|
BLAKE2b-256 | 8662f2ce3cb13a4c9af7dca2c7a6afcff052578cd39dca875eb6dca2bc21f3af |