Used for printing to the CLI in different colors and styles
Project description
AdvancedPrinter
AdvancedPrinter is a custom Python library designed to mimic the behavior of the print
function with added color and style options using ANSI escape codes. This allows you to print text with various colors and styles to the terminal.
Features
- Print text in different colors: black, red, green, yellow, blue, magenta, cyan, white, and orange.
- Apply styles to text: bold, italic, and underline.
- Customize background colors: bg_black, bg_red, bg_green, bg_yellow, bg_blue, bg_magenta, bg_cyan, bg_white, and bg_orange.
- Combine multiple styles: bold-italic, bold-underline, italic-underline, and bold-italic-underline.
Usage
-
Install the package from PyPi
pip install AdvancedPrinter
-
Import the
AdvancedPrinter
class into your Python script.from advancedprinter import AdvancedPrinter as AP
-
Use the
AdvancedPrint.print()
method to print colored text.# Example usage AP.print("Hello, colored world!", foreground="green") AP.print("Hello, bold red underlined italic text!", foreground="red", style="bold-italic-underline") AP.print("Hello, black text on blue background!", foreground="black", background="blue") AP.print("underline", style="underline") AP.print("bold-italic", style="bold-italic") AP.print("orange bold-italic", style="bold-italic", foreground='orange') AP.print("Hello, black text on white background!", foreground="black", background="white") # Additional arguments example AP.print("This is an example with additional arguments.", style="bold", end="***") # Example usage with different colors for different parts of the string name_color = 'GREEN' age_color = 'RED' style = 'BOLD' name = "Kaloian" age = 30 AP.print(f"\nHello, my name is ", foreground=name_color, style=style, end="") AP.print(f"{name}", foreground='blue', style=style, end="") AP.print(f" and I am ", foreground='white', style=style, end="") AP.print(f"{age}", foreground=age_color, style=style, end="") AP.print(" years old!", foreground='magenta', style=style)
License
This project is licensed under the MIT License - see the LICENSE file for details.
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
AdvancedPrinter-1.0.1.tar.gz
(3.8 kB
view hashes)
Built Distribution
Close
Hashes for AdvancedPrinter-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0364a61c4536e4f8b3826aa04cdfca612c62b9840b0cb8b9d6fc685cd96692da |
|
MD5 | 21f51df4675eb70b00c63b204e4146ca |
|
BLAKE2b-256 | dff0188829f0662a5adaae7d3fbf777ecb543621775d271bd2063b95baa88b51 |