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

Optionally

  1. Import print and line directly to override the inbuilt methods

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

    Example3

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.4.tar.gz (4.3 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.4-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: AdvancedPrinter-1.0.4.tar.gz
  • Upload date:
  • Size: 4.3 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.4.tar.gz
Algorithm Hash digest
SHA256 2506e4e48f5de6c86c5eee96a51fb6c38577db1dfe8407f7406ccf00ec2e450a
MD5 a326c7757c88f5427c118f10a6450114
BLAKE2b-256 f90bdd5c014c42dc6ceb63a4ca1161f30044afc01f7917eb8b201a4788470516

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for AdvancedPrinter-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 57cccf55d866ed01cbbe561f2581036cf40a0247f8c485cf90b338db38985078
MD5 3fbd4279001efce0773fb9d3c8dfcc94
BLAKE2b-256 1c221004688effdcff301fd8407db25fa7e783de513b3835ad4b7601c430d06b

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