Skip to main content

Running bofa

The main command is simple:
bofa
This displays an animated joke sequence with randomly selected visual effects from the terminal-text-effects library.

How It Works

When you run bofa, the tool:
  1. Detects your terminal environment - If output is not a TTY or TERM=dumb, it falls back to plain text
  2. Checks Unicode support - Tests if your terminal encoding supports Unicode characters like ✦❖✺
  3. Displays the intro - Shows “HAVE YOU HEARD OF BOFA?” with one of three random effects
  4. Plays an interlude (75% chance) - A VHS glitch effect with the text repeated
  5. Shows the punchline - Displays “BOFA DEEZ NUTS!!!” with fireworks, spotlights, and glitter effects

Animation Sequence

Intro Effects (Random Selection)

The intro uses one of three effects, chosen randomly:
A horizontal rainbow gradient that cycles through the text twice.
intro_config.cycles = 2
intro_config.gradient_stops = RAINBOW_STOPS
intro_config.travel_direction = Gradient.Direction.HORIZONTAL
Four spotlights search the terminal for 160 frames before revealing the text with a radial rainbow gradient.
spotlight_config.search_duration = 160
spotlight_config.spotlight_count = 4
spotlight_config.final_gradient_direction = Gradient.Direction.RADIAL
Text sprays in from a random direction (north, northeast, east, southeast, south, southwest, west, northwest, or center).
spray_config.spray_position = rng.choice(
    ("n", "ne", "e", "se", "s", "sw", "w", "nw", "center"),
)
spray_config.spray_volume = 0.08

Interlude Effect (75% probability)

After the intro, there’s a 75% chance of showing a VHS tape glitch effect:
if rng.random() < 0.75:
    _play_interlude(...)
The interlude displays the text ”…Bofa Bofa Bofa…” with:
  • 140 frames of total glitch time
  • 22% chance per line of glitch lines
  • 3% chance of noise
  • Rainbow glitch colors with white accents
From __init__.py:249-261:
glitch_config.total_glitch_time = 140
glitch_config.glitch_line_chance = 0.22
glitch_config.noise_chance = 0.03
glitch_config.glitch_line_colors = (
    Color("#ffffff"),
    *RAINBOW_STOPS,
    Color("#ffffff"),
)

Finale Effects (Always Plays)

The punchline is revealed through a sequence of three effects:
  1. Fireworks - Fireworks explode anywhere on screen with rainbow colors
    • Launch delay: 12 frames
    • Firework volume: 12% of canvas
    • Random Unicode or ASCII symbol per firework
  2. Spotlights - Five spotlights illuminate the final text
    • Search duration: 120 frames
    • Variable search speed: 0.7-1.4
    • Wider beams with 1.25x ratio and 25% falloff
  3. Glitter - A diagonal highlight sweep across the text
    • Brightness: 2.6x
    • Width: 14 characters
    • Random diagonal direction

Unicode vs ASCII Mode

The tool automatically detects if your terminal supports Unicode:
def _unicode_ok() -> bool:
    encoding = sys.stdout.encoding
    if not encoding:
        return False
    try:
        "✦❖✺".encode(encoding)
    except UnicodeEncodeError:
        return False
    return True
Unicode mode uses decorative characters:
  • Confetti border: ✦✧❖✺✹✷✸✶✱✲✳✴✵✼✽❇❈❉❊*+x~^@
  • Text decorations: and symbols around headers
  • Firework symbols: ✦✧❇❈✺*+x
ASCII fallback uses basic characters:
  • Confetti border: *+x~^@
  • No text decorations
  • Firework symbols: o*+x

Terminal Compatibility

The bofa command requires a TTY (interactive terminal). It automatically falls back to plain text output if:
  • Output is piped or redirected
  • TERM environment variable is set to dumb
The animation runs at 90 FPS with the canvas centered in your terminal:
terminal_config.frame_rate = 90
terminal_config.anchor_canvas = "c"  # center canvas
terminal_config.anchor_text = "c"     # center text

Keyboard Interrupt Handling

You can press Ctrl+C at any time to skip the animation. The tool catches KeyboardInterrupt and displays the plain text immediately:
try:
    _play_intro(...)
    if rng.random() < 0.75:
        _play_interlude(...)
except KeyboardInterrupt:
    print(msg)  # Plain text: "Bofa deez nuts"
    return
Interrupting during the finale also shows the plain text:
try:
    _play(Fireworks(...))
    _play_spotlights_finale(...)
    _play_glitter(...)
except KeyboardInterrupt:
    print(msg)
    return

Rainbow Colors

All effects use the same 7-color rainbow gradient:
RAINBOW_STOPS = (
    Color("#e81416"),  # Red
    Color("#ffa500"),  # Orange
    Color("#faeb36"),  # Yellow
    Color("#79c314"),  # Green
    Color("#487de7"),  # Blue
    Color("#4b369d"),  # Indigo
    Color("#70369d"),  # Violet
)

Text Width Calculation

The tool automatically sizes the text display based on your terminal width:
def _pick_width() -> int:
    columns = shutil.get_terminal_size(fallback=(80, 24)).columns
    target = columns - 2  # Leave 1 char padding on each side
    if target <= 0:
        target = columns
    return max(34, min(target, 120))  # Between 34-120 chars
  • Minimum width: 34 characters
  • Maximum width: 120 characters
  • Default fallback: 78 characters (80 - 2 for padding)

Build docs developers (and LLMs) love