Skip to main content

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

  1. Install the package from PyPi

    pip install AdvancedPrinter
    
  2. Import the AdvancedPrinter class into your Python script.

    from advancedprinter import AdvancedPrinter as AP
    
  3. 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)
    

    Example

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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

AdvancedPrinter-1.0.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file AdvancedPrinter-1.0.1.tar.gz.

File metadata

  • Download URL: AdvancedPrinter-1.0.1.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.0

File hashes

Hashes for AdvancedPrinter-1.0.1.tar.gz
Algorithm Hash digest
SHA256 ea6bfd8691c73565956c03ac24dffe41f44e643ebdff249c1681cb3199fbeef4
MD5 1ac0c3ae26e9a6bc07b5aa8dfdd6ce7b
BLAKE2b-256 b0892c06ca19ef67b9a480d76b448398dbc04352f5a75d4b60313f7f1f0a6991

See more details on using hashes here.

File details

Details for the file AdvancedPrinter-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for AdvancedPrinter-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0364a61c4536e4f8b3826aa04cdfca612c62b9840b0cb8b9d6fc685cd96692da
MD5 21f51df4675eb70b00c63b204e4146ca
BLAKE2b-256 dff0188829f0662a5adaae7d3fbf777ecb543621775d271bd2063b95baa88b51

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