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 = b, italic = it, and underline = u.
  • Combine styles: b-it, b-u, it-u, and b-it-u.

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 ap.print() method to print colored text.

    # Example usage
    ap.print("Green text", c="green")
    ap.print("Underlined text", s="u")
    ap.print("Bold italic text", s="b-it")
    ap.print("Orange italic underlined", s="it-u", c='orange')
    ap.print("White text on blue b!", c="white", b="blue")
    ap.print("Bold red underlined italic text!", c="red", s="b-it-u")
    
    # Additional arguments example
    ap.print("This is a bold example with additional arguments.", s="b", end="***")
    

    Example1

  4. Use ap.line() method to print multiple colors in line using nested f-strings

    name = "Kaloian"
    print(f"""{ap.line("Hello, my name is", c='green', s='b')} {ap.line(f"{name}", c='blue')} {ap.line("and I'm", c='white')} {ap.line("28", c='red')} {ap.line('years old!', c='magenta')}""", end='***')
    

    Example2

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support Me

Buy Me A Coffee

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.3.tar.gz (4.1 kB view hashes)

Uploaded Source

Built Distribution

AdvancedPrinter-1.0.3-py3-none-any.whl (4.6 kB view hashes)

Uploaded Python 3

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