This is an easy to use Python library which allows you to make your terminal outputs more colorful and therefore easier to read and understand
Project description
This is an easy to use Python library which allows you to make your terminal outputs more colorful and therefore easier to read and understand.
It currently only works with Python3
The creator and maintainer is Jannik Ramrath (jramrath)
GitHub: https://github.com/jramrath/textColor
PyPi: https://pypi.org/project/textColor/
Contributing
If you've found a bug or a typo, feel free to open an Issue on GitHub. Already have a solution? Make a Pull request and I'll take a look at your changes. Please make sure a similar Issue/Pull request doesn't already exist.
Installation
This library is hosted on pypi.org. You can install it with pip:
pip install textColor
Usage
To use this library, you first have to import it:
import textColor
To print colored text do the following:
print(textColor.green("GREEN")) # 'GREEN' will be green
print(textColor.red("RED")) # 'RED' will be red
print(textColor.blue("BLUE")) # 'BLUE' will be blue
print(textColor.yellow("YELLOW")) # 'YELLOW' will be yellow
You can also use special 'pre-fixes':
print(textColor.prompt("Name: ")) # will output '[?] Name: ' while '[?]' is yellow
print(textColor.info("Info")) # will output '[-] Info' while '[-]' is blue
print(textColor.error("ERROR")) # will output '[!] ERROR' while '[!]' is red
print(textColor.output("Success")) # will output '[>] Success' while '[>]' is green
If you dont' want to type input()/print() you can use the 'print functions':
textColor.pPromt("Name: ") # will call input("[?] Name: ") and return
# the output, while '[?]’ is yellow
textColor.pInfo("Info") # will output '[-] Info' while '[-]' is blue
textColor.pError("Error") # will output '[!] ERROR' while '[!]' is red
textColor.pOutput("Success") # will output '[>] Success' while '[>]' is green
If those function names seem too long, you should use abbreviations:
green ––> g
red ––> r
blue ––> b
yellow ––> y
error ––> err
output ––> out
pError ––> pErr
pOutput ––> pOut
License
This library was published under the GNU General Public License. For more information take a look at the LICENSE file.
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
Built Distribution
File details
Details for the file textcolor-3.1.0.tar.gz
.
File metadata
- Download URL: textcolor-3.1.0.tar.gz
- Upload date:
- Size: 14.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5be1df153efccede3e6976e9c4de49c3df900117e3f6227bc6a0e5e57ff99a5b |
|
MD5 | c5aeb21d319481d37d9b37e51cd11826 |
|
BLAKE2b-256 | b2c622e1b6e2859e8c09131b202f3db6b4ea667e255ebb1971c897ca40ce8c9a |
File details
Details for the file textcolor-3.1.0-py3-none-any.whl
.
File metadata
- Download URL: textcolor-3.1.0-py3-none-any.whl
- Upload date:
- Size: 14.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b91cf4f1d2c3e4f1bc3970d034572c64bb2268a92b84ad72c6344dcae702649 |
|
MD5 | 63c1442ad1a091b5c4789fa49e6011de |
|
BLAKE2b-256 | 7f83ffdc89bcb9f32e7e2fbfaf2f7469a295eddace8447ca9623ea3b993b5927 |