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, white, red, green, yellow, blue, magenta, cyan, orange, gray, olive - a list of all colors available by calling the helpmethod.
  • Apply styles to text: bold = b, italic = it, underline = u, inverted = inv, strike-through = str.
  • Combine styles: b-it, b-u, it-u, b-it-u etc.
  • Use frame method to frame text with different designs.

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

Import directly

  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

  2. Import the frame method to frame text with different designs

    from advancedprinter import frame
    
  • basic
     frame("This is a frame with basic design")
    
    Basic
  • basic2
    frame("This is a frame with basic2 design", f_s='basic2')
    
    Basic2
  • single
    frame("This is a frame with single design", f_s='single')
    
    Single
  • double
    frame("This is a frame with double design", f_s='double')
    
    Double
  • color (if no parameters are provided for the frame color, it will take the color and background of the text)
    frame("This is a frame with color", f_s='double', c='white', b='blue')
    
    Color
  • multiline / multicolor
    frame("""This is a frame with different
             text and frame color and
             multiple lines""", 
             f_s='double', f_c='black', f_b='olive', c='white', b='cyan', s='b-u-it')
    
    Multicolor

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.1.0.tar.gz (6.0 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.1.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for AdvancedPrinter-1.1.0.tar.gz
Algorithm Hash digest
SHA256 421d08cfc315280ea22d6c3a61e1ae1cf8e06fa8a11c20f6dc4f9f280d0b0d4d
MD5 69710324c776f3e660e70ee3acd48c94
BLAKE2b-256 f6b5995972622ccb9393763e250db294cc7ac1cb0718db1e4f2e059ecf309fc4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for AdvancedPrinter-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d712fccacd38a2b490512dce9cd5fff241337eaca25f2c02866708c738fee8a8
MD5 c66aea601f8da5cf87e91f7bf28b444e
BLAKE2b-256 3633fff7929f2f19688c7db988cbc0af43065d75fd07157fb04c79ab21ced75e

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