Dependencies
Source:pyproject.toml:10-12
- Python: Requires Python 3.10 or higher
- terminaltexteffects: Version 0.14.2 or higher
- Build System: Uses
uv_buildfor package building
Terminal Requirements
TTY Detection
Source:__init__.py:124-126
bofa checks if it’s running in an interactive terminal:
TERM=dumb, bofa skips animations and prints plain text.
Terminal Size Detection
Source:__init__.py:309-314
bofa automatically detects terminal dimensions and calculates optimal text width:
- Minimum: 34 characters (ensures text fits)
- Maximum: 120 characters (prevents excessive width)
- Margin: 2 columns reserved for borders
- Fallback: 80×24 if size cannot be detected
Unicode Encoding Detection
Source:__init__.py:49-57
bofa tests Unicode support before selecting characters:
Rendering Configuration
Terminal Config
Source:__init__.py:100-108
All effects use a shared terminal configuration:
| Parameter | Value | Purpose |
|---|---|---|
frame_rate | 90 fps | Smooth animations without flicker |
canvas_width | 0 (auto) | Adapts to terminal width |
canvas_height | 0 (auto) | Adapts to terminal height |
anchor_canvas | "c" | Centers canvas in terminal |
anchor_text | "c" | Centers text on canvas |
reuse_canvas | True | Efficient frame updates |
Effect Playback
Source:__init__.py:111-115
Each effect is played using the same rendering loop:
- Random seed is set per-effect for reproducible randomness within that effect
- Terminal context manager handles setup and cleanup
- Iterator yields frames at the configured frame rate
Character Rendering
Confetti Characters
Source:__init__.py:36-37
bofa uses different character sets based on Unicode support:
Firework Symbols
Source:__init__.py:303-306
Firework explosion particles adapt to terminal capabilities:
Color System
Rainbow Gradient
Source:__init__.py:38-46
All effects use a consistent 7-color rainbow gradient:
- Used as
final_gradient_stopsin all effects - VHSTape adds white endpoints for glitch effects (lines 254-256)
- Gradient directions vary by effect (horizontal, radial)
Gradient Directions
Fromterminaltexteffects.utils.graphics.Gradient.Direction:
- HORIZONTAL: Left to right color transition
- RADIAL: Center-outward color transition (used for spotlight effects)
Moon Mode
Source:moon.py:1-62
The --moon flag triggers ASCII art rendering with different logic:
Character Aspect Ratio
Source:moon.py:9
Circle Rendering
Source:moon.py:13-32
The moon uses distance-based rendering:
- Calculate radius
Rfrom terminal rows (max 10) - Calculate width
Waccounting for character aspect ratio - For each position, compute distance from center
- Place
#characters where distance ≈ radius
Crater Generation
Source:moon.py:10, 33-53
- Seed is fixed at 42 for consistent output (line 22)
- One crater per 12 interior positions (line 48)
- Center line (y=0) displays the payload text instead (lines 34-38)
Randomization
Effect Selection
Source:__init__.py:197-226
Intro effect chosen by random roll:
- 0.00-0.34: ColorShift (34%)
- 0.34-0.67: Spotlights (33%)
- 0.67-1.00: Spray (33%)
__init__.py:146-152
Interlude plays 75% of the time.
Random Number Generator
Source:__init__.py:133
A single random.Random() instance is created and passed to all functions, ensuring reproducible randomness within a run while allowing variety between runs.
Keyboard Interrupts
Source:__init__.py:153-155, 184-186
Keyboard interrupts (Ctrl+C) are handled gracefully: