Claude Code for pyfiglet: ASCII Art Text in Python — Claude Skills 360 Blog
Blog / AI / Claude Code for pyfiglet: ASCII Art Text in Python
AI

Claude Code for pyfiglet: ASCII Art Text in Python

Published: March 20, 2028
Read time: 5 min read
By: Claude Skills 360

pyfiglet renders text as ASCII art using FIGlet fonts. pip install pyfiglet. Basic: import pyfiglet; print(pyfiglet.figlet_format("Hello")). Font: pyfiglet.figlet_format("Hello", font="slant"). Width: pyfiglet.figlet_format("Hello", width=120). Justify: pyfiglet.figlet_format("Hi", justify="center") — left/right/center/auto. Class: from pyfiglet import Figlet; f = Figlet(font="doom"); f.renderText("Hello"). List fonts: pyfiglet.FigletFont.getFonts() — 150+ fonts. Common: standard, slant, banner, big, doom, cyberlarge, isometric3, letters, chunky, digital, ivrit, lean, mini, script, shadow, small, speed, starwars, stop, thin, 3-d, colossal, epic, fire, graffiti, larry3d, smslant, tinker-toy. Width: default 80; set to shutil.get_terminal_size().columns. Color: combine with colorama.Fore.GREEN + figlet_format(...) + colorama.Style.RESET_ALL. Rich: from rich.console import Console; Console().print(f"[green]{figlet_format('Hi')}[/green]"). Print centered: f.renderText("text").center(width). Multiline: newlines in input produce stacked letters. Custom: FigletFont.preloadFont("path/font.flf"). Claude Code generates pyfiglet CLI banners, version headers, and ASCII art startup screens.

CLAUDE.md for pyfiglet

## pyfiglet Stack
- Version: pyfiglet >= 1.0 | pip install pyfiglet
- Basic: pyfiglet.figlet_format("Hello", font="slant", width=80)
- Class: Figlet(font="doom", width=shutil.get_terminal_size().columns)
- Fonts: standard, slant, doom, big, banner, cyberlarge, starwars, isometric3, epic
- Justify: figlet_format("text", justify="center") | "left" | "right"
- List: pyfiglet.FigletFont.getFonts() → 150+ available fonts
- Color: combine with colorama or rich for colored ASCII art output

pyfiglet ASCII Art Banner Pipeline

# app/banners.py — pyfiglet ASCII art, colored banners, and CLI headers
from __future__ import annotations

import random
import shutil
from typing import Any

import pyfiglet
from pyfiglet import Figlet, FigletFont


# ─────────────────────────────────────────────────────────────────────────────
# 1. Core rendering helpers
# ─────────────────────────────────────────────────────────────────────────────

def render(
    text: str,
    font: str = "standard",
    width: int | None = None,
    justify: str = "auto",
) -> str:
    """
    Render text as ASCII art.
    font: any font from FigletFont.getFonts() — "slant", "doom", "big", etc.
    width: column width (defaults to terminal width).
    justify: "auto", "left", "right", "center"
    """
    w = width or shutil.get_terminal_size((80, 24)).columns
    return pyfiglet.figlet_format(text, font=font, width=w, justify=justify)


def render_centered(text: str, font: str = "slant", width: int | None = None) -> str:
    """Render centered ASCII art."""
    return render(text, font=font, width=width, justify="center")


def render_to_width(text: str, font: str = "big") -> str:
    """Render at full terminal width."""
    w = shutil.get_terminal_size((80, 24)).columns
    return render(text, font=font, width=w)


# ─────────────────────────────────────────────────────────────────────────────
# 2. Font discovery
# ─────────────────────────────────────────────────────────────────────────────

def list_fonts() -> list[str]:
    """Return all available FIGlet fonts, sorted."""
    return sorted(FigletFont.getFonts())


def preview_fonts(text: str = "Hello", fonts: list[str] | None = None) -> None:
    """
    Print a preview of each font.
    fonts: list to preview; defaults to a curated set.
    """
    showcase = fonts or [
        "standard", "slant", "doom", "big", "banner", "cyberlarge",
        "isometric3", "letters", "starwars", "epic", "shadow", "lean",
    ]
    for font in showcase:
        try:
            print(f"─── {font} ───")
            print(render(text, font=font))
        except Exception:
            print(f"  (failed to render {font!r})\n")


def random_font() -> str:
    """Return a random available font name."""
    return random.choice(list_fonts())


# ─────────────────────────────────────────────────────────────────────────────
# 3. Colored banners (requires colorama or rich)
# ─────────────────────────────────────────────────────────────────────────────

def colorama_banner(
    text: str,
    font: str = "slant",
    color: str = "GREEN",
    bright: bool = True,
) -> str:
    """
    Return a colored ASCII art string using colorama.
    color: COLORAMA color name — "GREEN", "RED", "CYAN", "YELLOW", "BLUE", "WHITE"
    """
    try:
        from colorama import Fore, Style, init
        init(autoreset=True)
        art = render(text, font=font)
        color_code = getattr(Fore, color.upper(), Fore.WHITE)
        bright_code = Style.BRIGHT if bright else ""
        return f"{bright_code}{color_code}{art}{Style.RESET_ALL}"
    except ImportError:
        return render(text, font=font)


def rich_banner(
    text: str,
    font: str = "slant",
    style: str = "bold green",
) -> None:
    """Print a styled ASCII art banner using rich.Console."""
    try:
        from rich.console import Console
        from rich.text import Text
        console = Console()
        art = render(text, font=font)
        console.print(Text(art, style=style))
    except ImportError:
        print(render(text, font=font))


# ─────────────────────────────────────────────────────────────────────────────
# 4. CLI header patterns
# ─────────────────────────────────────────────────────────────────────────────

def cli_header(
    title: str,
    version: str = "",
    subtitle: str = "",
    font: str = "slant",
    separator: str = "═",
) -> str:
    """
    Generate a complete CLI application header:
      ASCII art title
      ══════════════════
      subtitle  v1.0.0
    """
    width = shutil.get_terminal_size((80, 24)).columns
    art   = render_centered(title, font=font, width=width)
    sep   = separator * width

    parts = [art.rstrip(), sep]
    if subtitle or version:
        info = f"  {subtitle}"
        if version:
            info = info.rstrip() + f"  v{version}"
        parts.append(info)
        parts.append(sep)

    return "\n".join(parts)


def startup_banner(
    app_name: str,
    version: str,
    environment: str = "development",
    font: str = "slant",
) -> str:
    """
    Generate a startup banner for long-running services.
    Shows app name, version, and environment.
    """
    art = render_centered(app_name, font=font)
    width = shutil.get_terminal_size((80, 24)).columns
    sep   = "─" * width

    env_color_map = {
        "production":  "🔴 PRODUCTION",
        "staging":     "🟡 STAGING",
        "development": "🟢 DEVELOPMENT",
    }
    env_label = env_color_map.get(environment.lower(), environment.upper())

    lines = [
        art.rstrip(),
        sep,
        f"  Version: {version}   Environment: {env_label}",
        sep,
    ]
    return "\n".join(lines)


def box_header(title: str, font: str = "standard") -> str:
    """Render title in a simple box frame."""
    art   = render(title, font=font).rstrip()
    width = max(len(line) for line in art.split("\n")) + 4
    top   = "┌" + "─" * (width - 2) + "┐"
    bot   = "└" + "─" * (width - 2) + "┘"
    lines = [top]
    for line in art.split("\n"):
        if line.strip():
            lines.append("│ " + line.ljust(width - 4) + " │")
    lines.append(bot)
    return "\n".join(lines)


# ─────────────────────────────────────────────────────────────────────────────
# 5. Multi-line and multi-word helpers
# ─────────────────────────────────────────────────────────────────────────────

def word_stack(words: list[str], font: str = "slant") -> str:
    """Render each word on its own line with the same font."""
    return "\n".join(render(w, font=font).rstrip() for w in words)


def font_sampler(text: str = "Hello", n: int = 10) -> dict[str, str]:
    """
    Return ASCII art for `text` in `n` random fonts.
    Returns {"font_name": "rendered art"}.
    """
    fonts = random.sample(list_fonts(), min(n, len(list_fonts())))
    return {font: render(text, font=font) for font in fonts}


# ─────────────────────────────────────────────────────────────────────────────
# Demo
# ─────────────────────────────────────────────────────────────────────────────

if __name__ == "__main__":
    print("=== Basic render ===")
    print(render("Hi"))

    print("=== Font showcase ===")
    showcase_fonts = ["slant", "doom", "big", "banner", "cyberlarge"]
    for font in showcase_fonts:
        print(f"[{font}]")
        print(render("Claude", font=font))

    print("=== CLI header ===")
    print(cli_header("MyApp", version="2.1.0", subtitle="Fast Python CLI tool"))

    print("\n=== Startup banner ===")
    print(startup_banner("Paperclip", "1.0.0", environment="development"))

    print("\n=== Box header ===")
    print(box_header("OK"))

    print("\n=== Available fonts count ===")
    fonts = list_fonts()
    print(f"  {len(fonts)} fonts available")
    print(f"  Sample: {fonts[:10]}")

    print("\n=== Centered render ===")
    print(render_centered("Python", font="big"))

For the art alternative — the art package provides text2art("Hello") with different styles and also exposes random art selection with tprint("Hello", "random"); pyfiglet has more fonts (150+ FIGlet fonts versus art’s smaller set) and is better at the standard FIGlet font ecosystem where most pre-made fonts live; both are suitable for CLI banners. For the figlet command-line tool alternative — figlet is the original C program that pyfiglet reimplements in pure Python; since pyfiglet ships the font files as Python data, your CLI tool has no external dependency and works on every OS without needing to install the figlet binary separately. The Claude Skills 360 bundle includes pyfiglet skill sets covering pyfiglet.figlet_format() with font/width/justify, Figlet() class, FigletFont.getFonts() font discovery, render()/render_centered()/render_to_width() helpers, colorama_banner() colored output, rich_banner() rich-styled output, cli_header() application startup banner, startup_banner() with environment indicator, box_header() framed output, word_stack() multi-word rendering, font_sampler() random font previewer, and preview_fonts() showcase. Start with the free tier to try ASCII art banner code generation.

Keep Reading

AI

Claude Code for email.contentmanager: Python Email Content Accessors

Read and write EmailMessage body content with Python's email.contentmanager module and Claude Code — email contentmanager ContentManager for the class that maps content types to get and set handler functions allowing EmailMessage to support get_content and set_content with type-specific behaviour, email contentmanager raw_data_manager for the ContentManager instance that handles raw bytes and str payloads without any conversion, email contentmanager content_manager for the standard ContentManager instance used by email.policy.default that intelligently handles text plain text html multipart and binary content types, email contentmanager get_content_text for the handler that returns the decoded text payload of a text-star message part as a str, email contentmanager get_content_binary for the handler that returns the raw decoded bytes payload of a non-text message part, email contentmanager get_data_manager for the get-handler lookup used by EmailMessage get_content to find the right reader function for the content type, email contentmanager set_content text for the handler that creates and sets a text part correctly choosing charset and transfer encoding, email contentmanager set_content bytes for the handler that creates and sets a binary part with base64 encoding and optional filename Content-Disposition, email contentmanager EmailMessage get_content for the method that reads the message body using the registered content manager handlers, email contentmanager EmailMessage set_content for the method that sets the message body and MIME headers in one call, email contentmanager EmailMessage make_alternative make_mixed make_related for the methods that convert a simple message into a multipart container, email contentmanager EmailMessage add_attachment for the method that attaches a file or bytes to a multipart message, and email contentmanager integration with email.message and email.policy and email.mime and io for building high-level email readers attachment extractors text body accessors HTML readers and policy-aware MIME construction pipelines.

5 min read Feb 12, 2029
AI

Claude Code for email.charset: Python Email Charset Encoding

Control header and body encoding for international email with Python's email.charset module and Claude Code — email charset Charset for the class that wraps a character set name with the encoding rules for header encoding and body encoding describing how to encode text for that charset in email messages, email charset Charset header_encoding for the attribute specifying whether headers using this charset should use QP quoted-printable encoding BASE64 encoding or no encoding, email charset Charset body_encoding for the attribute specifying the Content-Transfer-Encoding to use for message bodies in this charset such as QP or BASE64, email charset Charset output_codec for the attribute giving the Python codec name used to encode the string to bytes for the wire format, email charset Charset input_codec for the attribute giving the Python codec name used to decode incoming bytes to str, email charset Charset get_output_charset for returning the output charset name, email charset Charset header_encode for encoding a header string using the charset's header_encoding method, email charset Charset body_encode for encoding body content using the charset's body_encoding, email charset Charset convert for converting a string from the input_codec to the output_codec, email charset add_charset for registering a new charset with custom encoding rules in the global charset registry, email charset add_alias for adding an alias name that maps to an existing registered charset, email charset add_codec for registering a codec name mapping for use by the charset machinery, and email charset integration with email.message and email.mime and email.policy and email.encoders for building international email senders non-ASCII header encoders Content-Transfer-Encoding selectors charset-aware message constructors and MIME encoding pipelines.

5 min read Feb 11, 2029
AI

Claude Code for email.utils: Python Email Address and Header Utilities

Parse and format RFC 2822 email addresses and dates with Python's email.utils module and Claude Code — email utils parseaddr for splitting a display-name plus angle-bracket address string into a realname and email address tuple, email utils formataddr for combining a realname and address string into a properly quoted RFC 2822 address with angle brackets, email utils getaddresses for parsing a list of raw address header strings each potentially containing multiple comma-separated addresses into a list of realname address tuples, email utils parsedate for parsing an RFC 2822 date string into a nine-tuple compatible with time.mktime, email utils parsedate_tz for parsing an RFC 2822 date string into a ten-tuple that includes the UTC offset timezone in seconds, email utils parsedate_to_datetime for parsing an RFC 2822 date string into an aware datetime object with timezone, email utils formatdate for formatting a POSIX timestamp or the current time as an RFC 2822 date string with optional usegmt and localtime flags, email utils format_datetime for formatting a datetime object as an RFC 2822 date string, email utils make_msgid for generating a globally unique Message-ID string with optional idstring and domain components, email utils decode_rfc2231 for decoding an RFC 2231 encoded parameter value into a tuple of charset language and value, email utils encode_rfc2231 for encoding a string as an RFC 2231 encoded parameter value, email utils collapse_rfc2231_value for collapsing a decoded RFC 2231 tuple to a Unicode string, and email utils integration with email.message and email.headerregistry and datetime and time for building address parsers date formatters message-id generators header extractors and RFC-compliant email construction utilities.

5 min read Feb 10, 2029

Put these ideas into practice

Claude Skills 360 gives you production-ready skills for everything in this article — and 2,350+ more. Start free or go all-in.

Back to Blog

Get 360 skills free