4 releases
| 0.1.3 | Oct 13, 2025 |
|---|---|
| 0.1.2 | Oct 13, 2025 |
| 0.1.1 | Oct 13, 2025 |
| 0.1.0 | Oct 13, 2025 |
#438 in Text processing
49KB
1K
SLoC
Blocklet
A cross-platform CLI tool that generates ASCII art using Unicode block characters, similar to figlet but with beautiful solid Unicode blocks instead of outlines or hash symbols.
โจ Features
- ๐จ Unicode Block Characters: Uses solid Unicode blocks (โ) and box-drawing characters for beautiful text art
- ๐ Drop-Shadow Effect: Beautiful drop-shadows enabled by default using Unicode box-drawing
- ๐ Multi-Line Support: Pass multiple arguments to create multiple lines of output
- โฌ๏ธ Proper Descenders: Characters like Q, comma, and question mark extend below the baseline
- ๐ Text Wrapping: Automatic word wrapping with configurable width limits
- ๐ Cross-Platform: Works on Windows, macOS, and Linux
- โก Fast Performance: Optimized rendering engine with comprehensive benchmarks
- ๐งช Well Tested: Extensive unit tests ensuring reliability
- ๐ฆ Zero Runtime Dependencies: Single binary with everything built-in
๐ Quick Start
Installation
Install from crates.io:
cargo install blocklet
Or build from source:
git clone https://github.com/tanav-malhotra/blocklet.git
cd blocklet
cargo install --path .
Basic Usage
# Simple text rendering (with drop-shadow by default)
blocklet "Hello World"
# Multiple arguments = multiple lines
blocklet "Hello" "World"
# Mix quoted and unquoted arguments
blocklet "Hello World" Goodbye
# Disable drop-shadow for solid characters
blocklet "Clean Text" --no-shadow
# Short form to disable shadow
blocklet "Clean Text" -n
# With width limiting (word wrapping)
blocklet "This is a long text that will wrap" --width 40
# Choose different fonts
blocklet "Stylish" --font standard_solid
๐ง Command Line Options
blocklet [OPTIONS] <TEXT>...
ARGUMENTS:
<TEXT>... The text to convert to ASCII art (multiple arguments = multiple lines)
OPTIONS:
-w, --width <WIDTH> Maximum width for output (0 = no limit) [default: 0]
-f, --font <FONT> Font to use (standard, standard_shadow, standard_solid) [default: standard_shadow]
-n, --no-shadow Use solid font without shadow (same as --font standard_solid)
-h, --help Print help information
-V, --version Print version information
๐จ Fonts
Blocklet includes three font variants:
- standard_shadow (default): Beautiful box-drawing characters with built-in shadows and descenders (7 lines tall)
- standard_solid: Clean solid blocks without shadows (5 lines tall)
- standard: Alias for standard_shadow
The shadow font features proper typographic descenders for characters like Q, comma, and question mark!
๐๏ธ Architecture
Core Components
-
Font System (
src/font.rs)- Font character definitions using Unicode blocks
- Single, readable Unicode block font (standard)
- Character fallback system
-
Rendering Engine (
src/renderer.rs)- Text-to-blocks conversion
- Word wrapping functionality
- Multi-line text support
-
CLI Interface (
src/main.rs)- Command-line argument parsing
- Font selection and options
- Error handling
๐งช Testing
Run the test suite:
# Unit tests
cargo test
# Performance benchmarks
cargo bench
# Check test coverage
cargo tarpaulin --out Html
Test Categories
- Unit Tests: Individual component testing
- Integration Tests: End-to-end functionality
- Performance Benchmarks: Rendering speed optimization
- Cross-platform Tests: Windows, macOS, Linux compatibility
๐ Performance
Benchmarks on modern hardware show excellent performance:
- Short text (2 chars): ~51ns
- Medium text (11 chars): ~79ns
- Long text (43 chars): ~80ns
- Very long text (144 chars): ~107ns
Run your own benchmarks with:
cargo bench --bench rendering
๐ค Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
Development Setup
-
Prerequisites:
- Rust 1.70+ (2021 edition)
- Git
-
Clone and build:
git clone https://github.com/tanav-malhotra/blocklet.git cd blocklet cargo install --path . -
Run tests:
cargo test cargo bench -
Code style:
cargo fmt cargo clippy
Adding New Fonts
- Create character definitions in
src/font.rs - Add the font to the
FONTSHashMap - Add tests for the new font
- Update documentation
๐ License
This project is licensed under the GNU General Public License v3.0.
See LICENSE or https://www.gnu.org/licenses/gpl-3.0.html for details.
at your option.
๐ FAQ
Q: How is this different from figlet?
A: While figlet uses ASCII characters to create outlined text, Blocklet uses solid Unicode block characters (โ) for a more modern, filled appearance. It's designed to look better in modern terminals with Unicode support.
Q: Does it work on all terminals?
A: Yes, Blocklet works on any terminal that supports Unicode (UTF-8). This includes most modern terminals on Windows, macOS, and Linux.
Q: Can I create custom fonts?
A: Currently, fonts are built into the binary. Custom font support is planned for a future release.
Q: What about colored output?
A: Colored output is planned for a future release. Currently, the tool outputs monochrome Unicode blocks.
Q: How do I report bugs or request features?
A: Please open an issue on our GitHub repository.
๐ Related Projects
- figlet - Original ASCII art text generator
- toilet - Another ASCII art text generator
- banner - Classic UNIX text banner utility
๐ Changelog
See CHANGELOG.md for a detailed history of changes.
Made with โค๏ธ in Rust ๐ฆ
Dependencies
~1โ1.6MB
~28K SLoC