SVG header generator built in Mojo that converts ASCII art into SVG graphics with customizable gradient fills.
- Written in Mojo for performance
- Built-in color gradient presets
- Works with figlet/toilet fonts
- Two rendering modes: pixel mode and text mode
- Standalone binary when compiled
- Includes Python implementation for compatibility
- Mojo (for Mojo implementation)
- Pixi (for dependency management)
figletand/ortoilet(for ASCII art rendering)
# Install figlet/toilet on most Linux distros
sudo pacman -S figlet toilet # Arch
sudo apt install figlet toilet # Debian/Ubuntu# Clone the repository
git clone [email protected]:ryugen-io/svgheadergen.git
cd svgheadergen
# Install dependencies with pixi
pixi install
# Build the binary (optional)
just build
# or: mojo build svg_gen.mojo -o svg_gen# Using Mojo directly
mojo svg_gen.mojo "Hello World"
# Using compiled binary
./svg_gen "Hello World"
# Using Python fallback
python3 svg_gen.py "Hello World"# Specify output file and font
mojo svg_gen.mojo "Hello" -o header.svg -f banner3
# Use text mode with custom gradient
mojo svg_gen.mojo "World" -f future -t -g cyber_cyan
# Custom scale
mojo svg_gen.mojo "Test" -s 15# Run with justfile shortcuts
just run "My Text"
just pixel "Hello" -f big
just text "Future" -g sunset
# Build and benchmark
just build
just benchmarkConverts ASCII art characters to SVG path rectangles. Best for fonts using simple characters like #:
banner3bigstandard
mojo svg_gen.mojo "Hello" -f banner3Uses toilet's native SVG export. Best for fonts using Unicode box-drawing characters:
futurepagga
mojo svg_gen.mojo "Hello" -f future -tUsage: svg_gen.mojo [TEXT] [OPTIONS]
Arguments:
TEXT The text to render
Options:
-o, --output Output SVG file path (default: stdout)
-f, --font Figlet/toilet font name (default: banner3)
-s, --scale Scale factor for pixel mode (default: 10)
-g, --gradient Gradient preset name
-t, --text-mode Use text mode instead of pixel mode
-h, --help Show this help message
Run benchmarks to compare Mojo and Python implementations:
just benchmark# Format code
just fmt
# Run static checks
just check
# Clean build artifacts
just clean.
├── svg_gen.mojo # Main Mojo implementation
├── svg_gen.py # Python fallback implementation
├── plot_benchmark.mojo # Benchmarking utilities
├── justfile # Task automation
├── pixi.toml # Pixi environment config
└── README.md # This file
MIT
Contributions welcome! Please feel free to submit a Pull Request.