### Quick Start Path Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/_COMPLETION_SUMMARY.txt Follow this path to quickly learn how to use the library. It involves starting with the 'I want to use the library quickly' section in 00_START_HERE.md, then proceeding to the 'Quick Start' in README.md, and finally exploring Pattern 1 in usage-patterns.md. ```markdown Path 1: I want to use it quickly (5 min) → Start: 00_START_HERE.md "I want to use the library quickly" → Then: README.md "Quick Start" → Code: usage-patterns.md Pattern 1 ``` -------------------------------- ### List Borders Example Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/api-reference/CLI.md Example output of the `borders` command, listing available styles. ```bash $ rich-pyfiglet borders ASCII ASCII2 ASCII_DOUBLE_HEAD SQUARE SQUARE_DOUBLE_HEAD MINIMAL MINIMAL_HEAVY_HEAD MINIMAL_DOUBLE_HEAD SIMPLE SIMPLE_HEAD SIMPLE_HEAVY HORIZONTALS ROUNDED HEAVY HEAVY_EDGE HEAVY_HEAD DOUBLE DOUBLE_EDGE MARKDOWN ``` -------------------------------- ### Install rich-pyfiglet using uv Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/docs/docs.md Use this command to install the library using uv. ```sh uv add rich-pyfiglet ``` -------------------------------- ### List Fonts with Head Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/api-reference/CLI.md Example showing how to list fonts and display the first few using `head`. ```bash $ rich-pyfiglet fonts | head -20 1943____ 1row 3-d 3d-ascii 3d_diagonal ... ``` -------------------------------- ### Install rich-pyfiglet CLI tool using uv Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/docs/docs.md Use this command to install the CLI tool using uv. ```sh uv tool install rich-pyfiglet ``` -------------------------------- ### Complete Example: Combination of Options Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/api-reference/CLI.md Creates a banner with a specific font, multiple colors, width, justification, border style, and horizontal gradient. ```bash rich-pyfiglet "Complete" \ --font banner \ --colors red:yellow:green \ --width 100 \ --justify center \ --border DOUBLE \ --border-color blue \ --horizontal \ --quality 15 ``` -------------------------------- ### Install rich-pyfiglet using pip Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/docs/docs.md Use this command to install the library using pip. ```sh pip install rich-pyfiglet ``` -------------------------------- ### Run Interactive Demo Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/api-reference/CLI.md Launch the interactive demo to explore features. Can optionally start at a specific section. ```bash rich-pyfiglet demo ``` ```bash rich-pyfiglet demo animations ``` -------------------------------- ### Install rich-pyfiglet CLI tool using pipx Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/docs/docs.md Use this command to install the CLI tool using pipx. ```sh pipx install rich-pyfiglet ``` -------------------------------- ### RichFiglet with border settings Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/docs/docs.md Example demonstrating the use of border arguments like 'ROUNDED', 'border_color', and 'border_padding'. ```py rich_fig = RichFiglet( "Rich - PyFiglet", font="rounded", colors=["#ff0000", "magenta1"], border="ROUNDED", border_color="ff0000", border_padding = (1, 2), ) console.print(rich_fig) ``` -------------------------------- ### Try Rich-Pyfiglet CLI without Installing (uvx) Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/README.md Use uvx to run the rich-pyfiglet CLI command without a local installation. This is useful for quick testing or integration into shell scripts. ```sh uvx rich-pyfiglet 'Rich is awesome' --colors blue:green ``` -------------------------------- ### Basic Library Usage Example Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/api-reference/modules.md Shows how to instantiate and use the RichFiglet class to render text with specified font and colors. Requires the Rich library for console output. ```python from rich.console import Console from rich_pyfiglet import RichFiglet console = Console() fig = RichFiglet("Hello", font="banner", colors=["red", "blue"]) console.print(fig) ``` -------------------------------- ### CLI Demo Invocation Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/api-reference/modules.md Shows how to invoke the interactive demo module from the command line, with an option to start at a specific section. ```bash rich-pyfiglet demo # Start from beginning rich-pyfiglet demo animations # Jump to animations ``` -------------------------------- ### RichFiglet with advanced animation and quality settings Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/docs/docs.md Example showing advanced tweaking with custom quality and animation FPS. ```py rich_fig = RichFiglet( "Rich - PyFiglet", font="rounded", colors=["#ff0000", "bright_blue", "yellow", "green3"], animation="smooth_strobe", quality=10, fps=1.8, ) console.print(rich_fig) ``` -------------------------------- ### Basic RichFiglet usage Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/docs/docs.md Example of very basic usage with a Console object and custom font and colors. ```py from rich.console import Console from rich_pyfiglet import RichFiglet console = Console() rich_fig = RichFiglet( "Your Text Here", font="ansi_shadow", colors=["#ff0000", "bright_blue"], ) console.print(rich_fig) ``` -------------------------------- ### Dynamic Font Selection Example Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/README.md Selects the first available font from the library and renders a yellow banner with it. ```python from typing import get_args from rich_pyfiglet.fonts_list import ALL_FONTS fonts = get_args(ALL_FONTS) selected_font = fonts[0] # or choose by name, index, or random fig = RichFiglet( "Dynamic Font", font=selected_font, colors=["yellow"], ) console.print(fig) ``` -------------------------------- ### Run Rich-Pyfiglet Demo without Installing (uvx) Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/README.md Use uvx to execute the rich-pyfiglet demo script without installing the package locally. This allows for quick exploration of the library's features. ```sh uvx rich-pyfiglet demo ``` -------------------------------- ### Hex Codes Example Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/types.md Shows how to specify colors using CSS-style 6-digit hex codes. Colors are provided as a list of strings. ```python colors=["#ff0000", "#00ff00", "#0000ff"] ``` -------------------------------- ### RichFiglet Constructor Example Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/docs/docs.md This script demonstrates initializing RichFiglet with custom font, width, justification, colors, animation, and border settings. It's useful for creating visually rich ASCII art banners with advanced features. ```python from rich.console import Console from rich_pyfiglet import RichFiglet console = Console() righ_fig = RichFiglet( "Your Banner Here", font = "modular", width = 80, # Default = auto-detect terminal width justify = "center", # Default = "left" colors = ["#ff0000", "magenta1", "blue3"], horizontal = True # This will be ignored because animation is set quality = 10, # Default = None, which means auto-mode (recommended) animation = "fast_strobe", fps = 0.5, timer = 5.0, # Default = None remove_blank_lines = True, border = "ROUNDED", border_padding = (1, 2), border_color = "#ff0000", dev_mode = True, dev_console = console, # default prints debug info to stderr ): console.print(righ_fig) console.print("The rest of your Rich script") ``` -------------------------------- ### Try Rich-Pyfiglet CLI without Installing (pipx) Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/README.md Use pipx to run the rich-pyfiglet CLI command without a local installation. This is useful for quick testing or integration into shell scripts. ```sh pipx run rich-pyfiglet 'Rich is awesome' --colors blue:green ``` -------------------------------- ### Install rich-pyfiglet using uv Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/README.md Shows how to add the rich-pyfiglet package to your project using the 'uv' package manager. This is an alternative to pip. ```bash # Using uv uv add rich-pyfiglet ``` -------------------------------- ### Complete Reference Path Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/_COMPLETION_SUMMARY.txt For users seeking a complete understanding, this path starts with INDEX.md and suggests reading all documents in a recommended order. ```markdown Path 5: Complete reference (60 min) → Start: INDEX.md → Read: All documents in recommended order ``` -------------------------------- ### Animated Loading Banner Example Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/README.md Displays an animated 'Processing' banner with a smooth strobe effect, using a specific font, colors, quality, FPS, and a timer. ```python fig = RichFiglet( "Processing", font="slant", colors=["cyan", "magenta"], animation="smooth_strobe", quality=15, fps=5, timer=10, # Auto-stop after 10 seconds ) console.print(fig) console.print("Work complete!") ``` -------------------------------- ### RichFiglet with multiple colors and horizontal direction Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/docs/docs.md Example demonstrating the use of multiple colors and setting the direction to horizontal. ```py rich_fig = RichFiglet( "Rich - PyFiglet", font="ansi_shadow", colors=["#ff0000", "bright_blue", "yellow", "green3"], horizontal=True, ) console.print(rich_fig) ``` -------------------------------- ### RichFiglet with smooth strobe animation Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/docs/docs.md Example using a 'smooth_strobe' animation with multiple colors and a specific font. ```py rich_fig = RichFiglet( "Rich - PyFiglet", font="slant", colors=["#ff0000", "bright_blue", "yellow", "green3"], animation="smooth_strobe", ) console.print(rich_fig) ``` -------------------------------- ### RichFiglet with center justification Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/docs/docs.md Example demonstrating the 'justify' argument set to 'center' for full-width text alignment. ```py rich_fig = RichFiglet( "Rich - PyFiglet", font="slant", colors=["#ff0000", "bright_blue", "yellow", "green3"], justify="center", ) ``` -------------------------------- ### Run Rich-Pyfiglet Demo without Installing (pipx) Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/README.md Use pipx to execute the rich-pyfiglet demo script without installing the package locally. This allows for quick exploration of the library's features. ```sh pipx run rich-pyfiglet demo ``` -------------------------------- ### Named Colors Example Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/types.md Demonstrates the use of named colors, including basic, numbered variants, and custom bright/dark variations. Colors are provided as a list of strings. ```python colors=["red", "blue1", "bright_yellow"] ``` -------------------------------- ### Rainbow Banner with Border Example Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/README.md Creates a centered, rainbow-colored banner with a rounded magenta border. ```python from rich.console import Console from rich_pyfiglet import RichFiglet console = Console() fig = RichFiglet( "Rainbow", font="banner", colors=["red", "green", "blue", "magenta"], justify="center", border="ROUNDED", border_color="magenta", ) console.print(fig) ``` -------------------------------- ### Documentation Ready for Use Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/_COMPLETION_SUMMARY.txt Indicates that the documentation is ready for immediate use, outlining how users can start, navigate, find answers, and debug errors. It emphasizes the comprehensive nature of the content. ```markdown READY FOR USE ═════════════════════════════════════════════════════════════════════════════ The documentation is ready for immediate use. Users can: 1. Start with 00_START_HERE.md for orientation 2. Choose their reading path based on use case 3. Navigate using INDEX.md for cross-references 4. Find quick answers in specific documents 5. Debug errors using errors.md 6. Learn from 20 real-world patterns in usage-patterns.md The documentation covers: • Everything a user needs to know • Nothing they don't need • Clear, precise technical language • Practical, runnable examples • Comprehensive error guidance • Multiple entry points and paths Total package: 11 files, 3,941 lines, 132 KB of pure reference content. ``` -------------------------------- ### Type Hinting Example for Animation Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/api-reference/modules.md Illustrates how to use type hints with ANIMATION_TYPE for function signatures. This helps type checkers ensure correct animation types are used. ```python from typing import get_args from rich_pyfiglet import RichFiglet from rich_pyfiglet.rich_figlet import ANIMATION_TYPE def animate_text(text: str, animation: ANIMATION_TYPE) -> RichFiglet: return RichFiglet(text, colors=["red", "blue"], animation=animation) # Type checker knows animation must be one of 4 types ``` -------------------------------- ### CLI Interface Commands Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/_COMPLETION_SUMMARY.txt Reference for the command-line interface commands provided by the Rich-PyFiglet library, including their functionalities and usage examples. ```APIDOC ## Command-Line Interface (CLI) ### `figlet` command #### Description Main command for rendering text using FIGlet fonts and styles. #### Usage `figlet [OPTIONS] "Your Text Here"` #### Options - `--font FONT, -f FONT`: Specify the FIGlet font. - `--width WIDTH, -w WIDTH`: Set the output width. - `--justify JUSTIFY, -j JUSTIFY`: Text justification (left, center, right). - `--color COLOR, -c COLOR`: Text color or gradient. - `--border BORDER, -b BORDER`: Apply a border style. - `--border-color BORDER_COLOR`: Color for the border. - `--animation ANIMATION_TYPE, -a ANIMATION_TYPE`: Animation type. - `--speed SPEED, -s SPEED`: Animation speed. ### `fonts` command #### Description Lists all available FIGlet fonts. #### Usage `fonts [OPTIONS]` ### `borders` command #### Description Lists all available border styles. #### Usage `borders [OPTIONS]` ### `demo` command #### Description Launches an interactive demonstration of the library's features. #### Usage `demo [OPTIONS]` ### CLI Usage Examples Over 20 CLI usage examples are provided in the full documentation, covering various combinations of options and features. ``` -------------------------------- ### RGB Triplets Example Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/types.md Illustrates specifying colors using RGB triplets in the format 'rgb(r, g, b)'. Colors are provided as a list of strings. ```python colors=["rgb(255, 0, 0)", "rgb(0, 255, 0)"] ``` -------------------------------- ### Fixed-Width Section Header Example Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/README.md Creates a centered, double-bordered banner for a section header with a specified width, followed by configuration details. ```python fig = RichFiglet( "Configuration", width=80, font="small", colors=["blue"], justify="center", border="DOUBLE", ) console.print(fig) # Show config details config_text = "Hostname: localhost | Port: 8000 | Mode: Production" console.print(f"[dim]{config_text}[/dim]") ``` -------------------------------- ### CLI User Path Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/_COMPLETION_SUMMARY.txt Designed for users who need a command-line interface reference. Start with the 'I need a CLI reference' section in 00_START_HERE.md, then read the CLI reference in api-reference/CLI.md. ```markdown Path 3: CLI user (10 min) → Start: 00_START_HERE.md "I need a CLI reference" → Read: api-reference/CLI.md ``` -------------------------------- ### App Integration Path Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/_COMPLETION_SUMMARY.txt This path is for users integrating the library into an application. It includes starting with the 'I'm integrating into an app' section in 00_START_HERE.md, reading the complete API reference for RichFiglet.md, and referencing configuration.md, errors.md, and usage-patterns.md. ```markdown Path 2: I'm building an app (30 min) → Start: 00_START_HERE.md "I'm integrating into an app" → Read: api-reference/RichFiglet.md (complete) → Reference: configuration.md, errors.md, usage-patterns.md ``` -------------------------------- ### Error Debugging Path Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/_COMPLETION_SUMMARY.txt This path helps users debug errors. Start with the 'I got an error' section in 00_START_HERE.md, find the error message in errors.md, and follow the resolution steps. ```markdown Path 4: Error debugging (5-10 min) → Start: 00_START_HERE.md "I got an error" → Find: errors.md (search by error message) → Fix: Follow resolution steps ``` -------------------------------- ### Success Metrics Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/_COMPLETION_SUMMARY.txt Details the achieved success metrics for the documentation, highlighting complete API coverage, clear examples, error handling guidance, type system documentation, configuration reference, CLI reference, real-world patterns, and overall structure. ```markdown SUCCESS METRICS ═════════════════════════════════════════════════════════════════════════════ Target Achievement: ✅ Complete API coverage (14/14 parameters, 4/4 methods) ✅ Clear examples (60+ examples provided) ✅ Error handling guide (10 error cases, best practices) ✅ Type system documented (4 type aliases, color formats) ✅ Configuration reference (all options with behavior) ✅ CLI reference (4 commands, 20+ examples) ✅ Real-world patterns (20 usage patterns included) ✅ Searchable/indexed (INDEX.md, cross-references) ✅ Accessible structure (multiple entry points, paths) ✅ Professional quality (technical, precise, comprehensive) ``` -------------------------------- ### Quick run rich-pyfiglet CLI with uv Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/docs/docs.md Instantly try out the CLI using uv's quick run mode. ```sh uvx rich-pyfiglet 'Rich is awesome' --colors green3:purple -a gradient_down ``` -------------------------------- ### Use the CLI to Run Demo Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/README.md Executes a demonstration of the rich-pyfiglet library's features from the command line. ```bash rich-pyfiglet demo ``` -------------------------------- ### Basic CLI Usage Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/src/rich_pyfiglet/main_help.md Shows a simple command to render 'hello' using the default font and styling. ```bash rich-pyfiglet hello ``` -------------------------------- ### Render Text with Default Settings Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/api-reference/CLI.md Basic usage to render the string "Hello World" using the default font and width. ```bash rich-pyfiglet "Hello World" ``` -------------------------------- ### CLI with Font and Alignment Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/src/rich_pyfiglet/main_help.md Renders 'Hello World!' with the 'slant' font and centers the output. ```bash rich-pyfiglet 'Hello World!' --font slant -j center ``` -------------------------------- ### Quick run rich-pyfiglet CLI with pipx Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/docs/docs.md Instantly try out the CLI using pipx's run mode. ```sh pipx run rich-pyfiglet 'Rich is awesome' --colors blue1:magenta3 -h ``` -------------------------------- ### CLI Usage with Options Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/api-reference/CLI.md Render text with custom font, colors, and animation. ```bash rich-pyfiglet "Your Text" --font banner --colors red:blue --animation gradient_down ``` -------------------------------- ### Basic CLI Usage Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/api-reference/CLI.md Render text using the default font and settings. ```bash rich-pyfiglet "Your Text" ``` -------------------------------- ### Basic CLI Usage Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/configuration.md Render text using the command-line interface with specified font and colors. ```bash rich-pyfiglet "Your Text" --font standard --colors red:blue ``` -------------------------------- ### CLI with Color Gradient and Animation Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/src/rich_pyfiglet/main_help.md Applies a red, green, and blue color gradient to 'Hello World!' with a 'gradient_down' animation. ```bash rich-pyfiglet --colors red:green:blue -h 'Hello World!' ``` -------------------------------- ### Use Rich-PyFiglet via Command Line Interface Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/00_START_HERE.md Demonstrates various CLI commands for generating text with specific fonts and colors, listing available fonts and borders, and running an interactive demo. ```bash rich-pyfiglet "Your Text" --font banner --colors red:blue rich-pyfiglet fonts # List fonts rich-pyfiglet borders # List borders rich-pyfiglet demo # Interactive demo ``` -------------------------------- ### Basic RichFiglet Usage Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/README.md Demonstrates how to create and print a styled ASCII art banner with a gradient animation using RichFiglet. Requires importing Console and RichFiglet. ```python from rich.console import Console from rich_pyfiglet import RichFiglet console = Console() fig = RichFiglet( "Hello World", font="banner", colors=["red", "blue"], animation="gradient_down", border="ROUNDED", ) console.print(fig) ``` -------------------------------- ### Error Message Banner Example Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/README.md Generates a prominent 'ERROR' banner with a heavy red border and color, followed by a red error message. ```python fig = RichFiglet( "ERROR", font="big", colors=["red"], border="HEAVY", border_color="red", ) console.print(fig) console.print("[red]Fatal error: Database connection failed[/red]") ``` -------------------------------- ### Get Terminal Width Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/api-reference/RichFiglet.md Retrieves the current width of the terminal. Returns None if the width cannot be determined, such as when output is piped. Handles exceptions internally. ```python rich_fig = RichFiglet("Text") width = rich_fig.get_terminal_width() if width: print(f"Terminal is {width} characters wide") else: print("Terminal width cannot be determined") ``` -------------------------------- ### Get All Fonts Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/api-reference/modules.md Retrieves a list of all available FIGlet font names from the ALL_FONTS type alias. This is useful for validation or providing user options. ```python from rich_pyfiglet.fonts_list import ALL_FONTS from typing import get_args all_fonts = get_args(ALL_FONTS) # Get list of all font strings ``` -------------------------------- ### Multi-Color Static Gradient (Manual Quality) Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/configuration.md Demonstrates setting a specific number of gradient steps between colors for a static gradient. This allows for fine-tuning the smoothness of color transitions. ```python RichFiglet( "Text", colors=["red", "blue"], quality=20, # Explicitly set 20 gradient steps ) ``` -------------------------------- ### Incorrect usage of RichFiglet within a Rich Panel Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/docs/docs.md This example shows what NOT to do: placing a RichFiglet inside a Rich Panel, which can cause rendering and animation issues. ```py # Do NOT do this - this example shows what NOT to do: panel = Panel( RichFiglet( "My Text", font="rounded", colors=["#ff0000", "magenta1"], ), padding=(1, 2), ) console.print(panel) ``` -------------------------------- ### CLI Entry Point Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/api-reference/modules.md Defines the 'rich-pyfiglet' command-line entry point, which is configured in pyproject.toml to execute the cli function from the rich_pyfiglet.cli module. ```toml [project.scripts] rich-pyfiglet = "rich_pyfiglet.cli:cli" ``` -------------------------------- ### Displaying Server Configuration with ASCII Art Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/usage-patterns.md Uses Rich-PyFiglet to create a stylized title banner for displaying server configuration details. ```python from rich.console import Console from rich_pyfiglet import RichFiglet from rich.table import Table console = Console() # Show title title = RichFiglet("Server Config", font="standard", colors=["blue"]) console.print(title) ``` -------------------------------- ### Documentation Validation Results Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/_COMPLETION_SUMMARY.txt Confirms that all aspects of the documentation are complete and accurate, including API coverage, examples, error handling, type system, configuration, CLI commands, and cross-references. ```markdown VALIDATION RESULTS ═════════════════════════════════════════════════════════════════════════════ ✅ All exported symbols documented ✅ All parameters fully specified ✅ All types documented ✅ All errors documented ✅ All CLI commands documented ✅ All examples provided ✅ Cross-references checked ✅ No placeholder content ✅ All links valid (internal) ✅ Markdown syntax valid ✅ Code examples runnable/realistic ``` -------------------------------- ### Displaying a Configuration Table Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/usage-patterns.md Use the `Table` class from Rich to display configuration settings. This is useful for showing active parameters or status information. ```python from rich.console import Console from rich.table import Table console = Console() table = Table(title="Active Configuration") table.add_column("Setting", style="cyan") table.add_column("Value", style="magenta") table.add_row("Host", "localhost:8000") table.add_row("Environment", "production") table.add_row("Threads", "4") console.print(table) ``` -------------------------------- ### List Available Borders Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/api-reference/CLI.md Display a list of all supported border box styles. ```bash rich-pyfiglet borders ``` -------------------------------- ### Multi-Color Gradient with Custom Quality and Horizontal Flow Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/usage-patterns.md Creates a horizontal color gradient with multiple colors and fine-tuned quality for smooth transitions. This example uses hex color codes. ```python fig = RichFiglet( "Gradient", colors=["#ff0000", "#ff7f00", "#00ff00", "#0000ff"], # 4 colors = 3 transitions quality=8, # 8 steps per transition = 24 total colors horizontal=True, ) console.print(fig) ``` -------------------------------- ### File Structure Overview Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/README.md Displays the directory structure of the rich-pyfiglet documentation. ```text Documentation: ├── README.md (this file) ├── types.md ├── configuration.md ├── errors.md ├── usage-patterns.md └── api-reference/ ├── RichFiglet.md ├── CLI.md └── modules.md ``` -------------------------------- ### CLI with Multiple Colors and Animation Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/src/rich_pyfiglet/main_help.md Renders 'I <3 Rich' with a color gradient of red and blue, using the 'gradient_down' animation. ```bash rich-pyfiglet -c red:blue 'I <3 Rich' -a gradient_down ``` -------------------------------- ### Blog/Document Header Configuration Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/configuration.md Generate a header suitable for documents or blogs, featuring a specific font, centered justification, fixed width, and a double border with color. ```python RichFiglet( "Chapter 1", font="small", width=80, justify="center", border="DOUBLE", border_color="blue", ) ``` -------------------------------- ### CLI with Box Characters and Colors Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/src/rich_pyfiglet/main_help.md Creates a CLI tool output for 'My CLI Tool' with blue foreground, rounded box characters, and red box characters. ```bash rich-pyfiglet 'My CLI Tool' -c blue -b rounded -bc red ``` -------------------------------- ### Create Gradient with RichFiglet Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/README.md Illustrates how to create a gradient effect by passing multiple colors to the RichFiglet constructor. The gradient is static and not animated. ```python RichFiglet("Text", colors=["red", "green", "blue"]) ``` -------------------------------- ### Basic Banner Rendering Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/usage-patterns.md Renders text using the default 'standard' font and no colors. This is the simplest way to use the library. ```python from rich.console import Console from rich_pyfiglet import RichFiglet console = Console() fig = RichFiglet("Hello World") console.print(fig) ``` -------------------------------- ### RichFiglet Constructor Parameters Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/_COMPLETION_SUMMARY.txt Details on the parameters accepted by the RichFiglet class constructor, including their types, default values, and behavioral explanations. ```APIDOC ## RichFiglet Constructor ### Parameters - **text** (str) - The input text to render. - **font** (str, optional) - The FIGlet font to use. Defaults to 'standard'. - **width** (int, optional) - The maximum width for rendering. Defaults to terminal width. - **justify** (JUSTIFICATION, optional) - Text justification. Defaults to 'left'. - **color** (str | list[str], optional) - Text color or gradient colors. Defaults to None. - **animation_type** (ANIMATION_TYPE, optional) - Type of animation. Defaults to None. - **animation_speed** (float, optional) - Speed of the animation. Defaults to 1.0. - **border** (str, optional) - Type of border to apply. Defaults to None. - **border_color** (str, optional) - Color of the border. Defaults to None. - **border_justify** (JUSTIFICATION, optional) - Justification for the border. Defaults to 'left'. - **direction** (str, optional) - Text direction (e.g., 'left_to_right', 'right_to_left'). Defaults to 'left_to_right'. - **skip_empty_lines** (bool, optional) - Whether to skip empty lines. Defaults to False. - **char_map** (dict, optional) - Custom character mapping. Defaults to None. - **fallback_char** (str, optional) - Character to use for unsupported glyphs. Defaults to '?'. ### Default Values Default values are documented for each parameter. Refer to the full documentation for specifics. ### Behavioral Details Detailed explanations of how each parameter affects the rendering and behavior of the RichFiglet object are provided in the full documentation. ``` -------------------------------- ### Import RichFiglet with Type Hinting Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/api-reference/modules.md Demonstrates advanced type imports for mypy or IDE support. This allows for explicit type checking of library components. ```python # Basic usage (recommended) from rich_pyfiglet import RichFiglet # Advanced: explicit type imports (for mypy/IDE) from rich_pyfiglet.rich_figlet import ANIMATION_TYPE, JUSTIFICATION from rich_pyfiglet.fonts_list import ALL_FONTS from rich_pyfiglet.box_constants import BOX_STYLES ``` -------------------------------- ### Render a Simple Banner Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/README.md Renders a basic ASCII art banner using RichFiglet and prints it to the console. ```python from rich.console import Console from rich_pyfiglet import RichFiglet console = Console() fig = RichFiglet("My Title") console.print(fig) ``` -------------------------------- ### __rich_console__(console: Console, options: ConsoleOptions) Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/api-reference/RichFiglet.md Implements the Rich renderable protocol for displaying the RichFiglet output. It yields the appropriate renderable based on animation settings, or drives the animation loop. ```APIDOC ## __rich_console__(console: Console, options: ConsoleOptions) ### Description Implements the Rich renderable protocol for displaying the RichFiglet output. It yields the appropriate renderable based on animation settings, or drives the animation loop. ### Method `__rich_console__(console: Console, options: ConsoleOptions)` ### Yields - Without animation: `Lines` or `Panel` (with or without border) - With animation: nothing; instead drives the animation loop via `Live` context ``` -------------------------------- ### Basic Banner with Single Color Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/api-reference/RichFiglet.md Renders a simple banner with a specified font and a single color. Requires importing Console and RichFiglet. ```python from rich.console import Console from rich_pyfiglet import RichFiglet console = Console() rich_fig = RichFiglet("Hello World", font="ansi_shadow", colors=["blue"]) console.print(rich_fig) ``` -------------------------------- ### Justification Configuration Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/configuration.md Align the text within the available width using 'center', 'right', or 'left' justification. ```python RichFiglet("Text", justify="center") # Center-align ``` ```python RichFiglet("Text", justify="right") # Right-align ``` ```python RichFiglet("Text", justify="left") # Left-align (default) ``` -------------------------------- ### RichFiglet Class Constructor Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/README.md Shows the signature for the RichFiglet class constructor, detailing all available parameters for text, font, width, justification, colors, animation, and borders. ```python class RichFiglet: def __init__( self, text: str, font: ALL_FONTS = "standard", width: int | None = None, justify: JUSTIFICATION = "left", colors: list[str] | None = None, horizontal: bool = False, quality: int | None = None, animation: ANIMATION_TYPE | None = None, fps: float | None = None, timer: float | None = None, remove_blank_lines: bool = False, border: BOX_STYLES | None = None, border_padding: tuple[int, int] = (1, 2), border_color: str | None = None, dev_mode: bool = False, dev_console: Console | None = None, ) -> None ``` -------------------------------- ### Panel with Box Style Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/api-reference/modules.md Demonstrates how a Panel is constructed using a specific box style from the BOXES dictionary, which maps style names to Rich Box objects. ```python panel = Panel( lines, box=BOXES[self.border], padding=self.border_padding, ) ``` -------------------------------- ### Animate ASCII Art with Rich-PyFiglet Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/00_START_HERE.md Creates an animated ASCII art display using specified colors, animation type, frames per second, and timer duration. Requires Console for printing. ```python fig = RichFiglet( "Loading", colors=["cyan", "magenta"], animation="gradient_down", fps=5, timer=10, ) console.print(fig) ``` -------------------------------- ### List Available Fonts Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/api-reference/CLI.md Display a list of all supported FIGlet fonts. ```bash rich-pyfiglet fonts ``` -------------------------------- ### Animation: Gradient Up Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/api-reference/CLI.md Create an upward-flowing color gradient animation. Control speed with `--fps`. ```bash rich-pyfiglet "Rising" --colors blue:yellow:red --animation gradient_up --fps 3 ``` -------------------------------- ### Project Structure Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/INDEX.md This snippet outlines the directory structure of the rich-pyfiglet project, highlighting key files and their roles. ```text src/rich_pyfiglet/ ├── __init__.py (exports RichFiglet) ├── rich_figlet.py (775 lines, core class) ├── fonts_list.py (500+ fonts) ├── box_constants.py (18 border styles) ├── cli.py (268 lines, CLI) └── demo.py (interactive demo) ``` -------------------------------- ### Basic Border Configuration Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/configuration.md Apply a basic 'ROUNDED' border style to the RichFiglet output. ```python RichFiglet( "Text", border="ROUNDED", ) ``` -------------------------------- ### RichFiglet Constructor Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/api-reference/RichFiglet.md Initializes a RichFiglet object to render ASCII art text. This constructor accepts numerous parameters to customize the appearance, styling, and animation of the banner. ```APIDOC ## RichFiglet Constructor ### Description Initializes a RichFiglet object to render ASCII art text banners with Rich styling, gradients, animations, and borders. ### Method __init__ ### Parameters #### Constructor Parameters - **text** (`str`) - Required - The text to render as ASCII art. Cannot be empty. - **font** (`ALL_FONTS`) - Optional - Default: `"standard"` - FIGlet font to use. Must be one of the fonts in `fonts_list.ALL_FONTS`. - **width** (`int | None`) - Optional - Default: `None` - Width in characters for the rendered banner. If `None`, auto-detects terminal width. If a border is specified, width is adjusted to account for border padding. - **justify** (`JUSTIFICATION`) - Optional - Default: `"left"` - Text justification within the width. Valid values: `"left"`, `"center"`, `"right"`. - **colors** (`list[str] | None`) - Optional - Default: `None` - List of colors for gradients or animations. Requires at least 2 colors if using gradients or animations. - **horizontal** (`bool`) - Optional - Default: `False` - When `True`, applies gradient horizontally across the banner. Ignored if `animation` is set. - **quality** (`int | None`) - Optional - Default: `None` - Number of gradient steps between color transitions. If set, must be >= 2. - **animation** (`ANIMATION_TYPE | None`) - Optional - Default: `None` - Animation mode: `"gradient_up"`, `"gradient_down"`, `"smooth_strobe"`, `"fast_strobe"`. Requires at least 2 colors. Cannot be combined with `horizontal=True`. - **fps** (`float | None`) - Optional - Default: `None` - Animation frame rate. Must be > 0 if specified. - **timer** (`float | None`) - Optional - Default: `None` - Animation duration in seconds. If `None`, animation runs indefinitely. - **remove_blank_lines** (`bool`) - Optional - Default: `False` - When `True`, removes all blank lines from within the rendered ASCII art. - **border** (`BOX_STYLES | None`) - Optional - Default: `None` - Box style for the border. Valid values from Rich box styles. - **border_padding** (`tuple[int, int]`) - Optional - Default: `(1, 2)` - Padding around the banner inside the border: `(vertical, horizontal)`. - **border_color** (`str | None`) - Optional - Default: `None` - Color of the border. Uses same color format as `colors` parameter. - **dev_mode** (`bool`) - Optional - Default: `False` - When `True`, prints debug information. - **dev_console** (`Console | None`) - Optional - Default: `None` - Rich `Console` object for dev mode output. ### Constructor Behavior #### Validation The constructor validates: - `text` is not empty - `font` exists in the available fonts list - At least 2 colors provided if `animation` or `quality` is set - `quality` >= 2 if specified - `animation` is one of the 4 valid types if specified - `fps` > 0 if specified - `width` > 0 if specified - All colors are valid Rich color strings ``` -------------------------------- ### Multi-Color Static Gradient (Vertical) Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/configuration.md Shows how to create a non-animated gradient using multiple colors. The gradient flows from top to bottom by default. The gradient is computed once during initialization. ```python RichFiglet( "Text", colors=["red", "green", "blue"], horizontal=False, # Gradient flows top-to-bottom ) ``` -------------------------------- ### RichFiglet Methods Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/INDEX.md Lists the available methods for the RichFiglet class, including terminal width detection, color parsing, gradient creation, and Rich console integration. ```python get_terminal_width() -> int | None ``` ```python parse_color(color: str) -> Color ``` ```python make_gradient(color1: Color, color2: Color, steps: int) -> list[Color] ``` ```python __rich_console__(console: Console, options: ConsoleOptions) -> RenderResult ``` ```python __rich_measure__(console: Console, options: ConsoleOptions) -> Measurement ``` -------------------------------- ### Render Text with Single Color Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/api-reference/CLI.md Apply a single color to the text using the `--colors` option with a named color. ```bash rich-pyfiglet "Red Text" --colors red ``` -------------------------------- ### Reusable Header Function with Configurations Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/usage-patterns.md Creates a helper function to print styled header banners using predefined configurations for different styles like default, warning, and success. ```python from rich.console import Console from rich_pyfiglet import RichFiglet def header(text, style="default"): """Print a styled header banner.""" configs = { "default": { "font": "banner", "colors": ["blue"], "border": "ROUNDED", }, "warning": { "font": "slant", "colors": ["yellow", "red"], "border": "HEAVY", "border_color": "red", }, "success": { "font": "standard", "colors": ["green"], "border": "SIMPLE", }, } config = configs.get(style, configs["default"]) fig = RichFiglet(text, **config) Console().print(fig) # Usage header("Welcome") header("Warning: Critical Update", style="warning") header("Installation Complete", style="success") ``` -------------------------------- ### Rich Renderable Protocol: Console Output Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/api-reference/RichFiglet.md Implements the Rich renderable protocol for console output. Yields Lines or a Panel for static content, or nothing for animated content to drive the Live context. ```python def __rich_console__(self, console: Console, options: ConsoleOptions ) -> RenderResult: ``` -------------------------------- ### Define Justification Modes Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/types.md Enumerates text justification options for banner alignment. Defaults to 'left'. ```python JUSTIFICATION = Literal["left", "center", "right"] ``` -------------------------------- ### Creating a RichFiglet Banner for Transparent Backgrounds Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/usage-patterns.md Banners automatically inherit the terminal's background color. Use contrasting colors for text to ensure visibility on both dark and light backgrounds. ```python from rich_figlet import RichFiglet # Terminal with dark background fig = RichFiglet("Text", colors=["white"]) # Terminal with light background fig = RichFiglet("Text", colors=["black"]) ``` -------------------------------- ### Render ASCII Art with Rich-PyFiglet Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/00_START_HERE.md Basic usage for rendering ASCII art with a specified font. Requires importing Console and RichFiglet. ```python from rich.console import Console from rich_pyfiglet import RichFiglet console = Console() fig = RichFiglet("Hello World", font="banner") console.print(fig) ``` -------------------------------- ### Import RichFiglet Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/docs/docs.md Import the RichFiglet class into your Python project. ```py from rich_pyfiglet import RichFiglet ``` -------------------------------- ### CLI Entry Point Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/api-reference/modules.md References the CLI entry point, which is called when the script is executed directly. This code is part of the command-line interface implementation. ```python from rich_pyfiglet.cli import cli if __name__ == "__main__": cli() # Entry point for command-line ``` -------------------------------- ### Auto Width Configuration Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/configuration.md Render text using the full terminal width, automatically detected by the constructor. ```python RichFiglet("Text") # Uses terminal width ``` -------------------------------- ### Render Text with Justification Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/api-reference/CLI.md Align the rendered text using the `--justify` option. Options include `left`, `center`, and `right`. ```bash rich-pyfiglet "Center" --justify center ``` -------------------------------- ### Testing RichFiglet Banners with Fixed Settings Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/usage-patterns.md For deterministic output in tests, configure `RichFiglet` with fixed settings such as font, width, and colors. Disabling `dev_mode` prevents stderr output. ```python from rich_figlet import RichFiglet def test_banner_rendering(): fig = RichFiglet( "Test", font="standard", width=80, # Fixed width colors=["blue"], # No animation dev_mode=False, # No stderr output ) # Render to console for snapshot comparison ``` -------------------------------- ### Integrating Figlet Banners with Logging Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/usage-patterns.md Uses RichHandler to set up logging and Rich-PyFiglet to print stylized section headers before and after logging messages. ```python import logging from rich.console import Console from rich_pyfiglet import RichFiglet from rich.logging import RichHandler # Setup logging with Rich console = Console() logging.basicConfig( level=logging.INFO, format="%(message)s", handlers=[RichHandler(console=console)], ) logger = logging.getLogger(__name__) # Print section headers with banners fig = RichFiglet("Database Sync", font="slant", colors=["cyan"]) console.print(fig) logger.info("Connecting to database...") logger.info("Syncing records...") logger.info("Verifying data...") fig = RichFiglet("Sync Complete", font="slant", colors=["green"]) console.print(fig) ``` -------------------------------- ### Package Root Export Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/api-reference/modules.md The main entry point for the rich_pyfiglet package exports the RichFiglet class. ```python from rich_pyfiglet.rich_figlet import RichFiglet __all__ = ["RichFiglet"] ``` -------------------------------- ### RichFiglet Public Methods Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/README.md Provides access to utility methods for retrieving terminal width, parsing colors, and generating color gradients. ```APIDOC ## RichFiglet Public Methods ### Description These are the public methods available on the `RichFiglet` class for utility purposes. ### Methods #### `get_terminal_width()` - **Description**: Returns the current terminal width or None if it cannot be determined. - **Returns**: `int | None` #### `parse_color(color: str)` - **Description**: Parses a color string (named, hex, or RGB) into a Rich `Color` object. - **Parameters**: - **color** (str) - The color string to parse. - **Returns**: `Color` #### `make_gradient(color1: Color, color2: Color, steps: int)` - **Description**: Generates a list of Rich `Color` objects representing a gradient between two specified colors. - **Parameters**: - **color1** (Color) - The starting color. - **color2** (Color) - The ending color. - **steps** (int) - The number of color steps in the gradient. - **Returns**: `list[Color]` ``` -------------------------------- ### Accessibility-Friendly Animation Configuration Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/configuration.md Configure an animation with a slow frame rate and no timer for safe, continuous display, suitable for accessibility. ```python RichFiglet( "Loading...", font="standard", colors=["green", "yellow"], animation="gradient_down", fps=1.5, # Slow, safe timer=None, ) ``` -------------------------------- ### Chain CLI Commands in Shell Scripts Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/api-reference/CLI.md Shows how to use rich-pyfiglet at the beginning and end of a shell script to display status messages. ```bash # Display at the start of a script rich-pyfiglet "Starting Backup..." --colors green --border ROUNDED # Do work... ls -la | head -20 # Display completion rich-pyfiglet "Done!" --colors blue ``` -------------------------------- ### Read CLI Help Text Source: https://github.com/edward-jazzhands/rich-pyfiglet/blob/main/_autodocs/api-reference/modules.md Reads the markdown help text for the CLI. This is used to display help messages when the --help flag is used. ```python from pathlib import Path main_help_path = Path(__file__).parent / "main_help.md" main_help = main_help_path.read_text() ```