A versatile Go application that converts text into ASCII art using various stylized fonts with support for colors, alignment options, and file output.
- Multiple Font Styles: Choose from
standard,shadow, orthinkertoyASCII art fonts - Color Support: Add colors to your ASCII art with various color formats
- Text Alignment: Align your text with left, right, center, or justify options
- File Output: Save your ASCII art directly to text files
- Input Validation: Handles only printable ASCII characters (32-126)
- Newline Support: Process text with
\nfor multi-line ASCII art
- Go 1.20 or later
- Unix-like environment (for terminal size detection in alignment features)
- Clone the repository:
git clone <repository-url>
cd ascii-art- Ensure you have Go 1.20 or later installed:
go version- Run the application:
go run .Generate ASCII art with default settings:
go run . "Hello World"Specify a banner style:
go run . "Hello World" standard
go run . "Hello World" shadow
go run . "Hello World" thinkertoygo run . --color=red "Hello World"
go run . --color=blue "Hello World"Available colors: red, green, blue, yellow, purple, orange, pink, cyan, magenta, gray
Color only specific letters:
go run . --color=red "el" "Hello World"RGB Format:
go run . --color=rgb(255,0,0) "Hello World"Hexadecimal Format:
go run . --color=#FF0000 "Hello World"HSL Format:
go run . --color=hsl(0,100%,50%) "Hello World"Color Mixing:
go run . --color=red,blue "Hello World"go run . --align=left "Hello World" standardgo run . --align=right "Hello World" standardgo run . --align=center "Hello World" standardgo run . --align=justify "Hello World" standardSave ASCII art to a file:
go run . --output=result.txt "Hello World" standardUse \n for line breaks:
go run . "Hello\nWorld" standardgo run . "Hello" standardOutput:
_ _ _ _
| | | | | | | |
| |__| | ___ | | | | ___
| __ | / _ \ | | | | / _ \
| | | | | __/ | | | | | (_) |
|_| |_| \___| |_| |_| \___/
go run . "Hello" thinkertoyOutput:
o o o o
| | | |
O--O o-o | | o-o
| | |-' | | | |
o o o-o o o o-o
go run . --color=blue "Hello" go run . --align=center "Hello"go run . --output=my_art.txt "Hello World"ascii-art/
βββ main.go # Main application entry point
βββ go.mod # Go module file
βββ tools/ # Package containing core functionality
β βββ colorCode.go # Color processing functions
β βββ getTxt.go # File reading utilities
β βββ isvalid.go # Input validation
β βββ justify.go # Text alignment functions
β βββ printascii.go # ASCII art generation
β βββ recognize.go # Color format recognition
β βββ Recuperation.go # Character retrieval from banners
βββ banners/ # ASCII art font files
β βββ standard.txt # Standard font
β βββ shadow.txt # Shadow font
β βββ thinkertoy.txt # Thinkertoy font
βββ README.md # This file
The application provides clear error messages for common issues:
- Invalid arguments: Shows proper usage format
- Unsupported characters: Only ASCII characters (32-126) are supported
- Invalid color formats: Validates color syntax
- Missing files: Checks for banner file existence
Run the included tests:
go testThe project includes comprehensive tests for:
- Basic ASCII art generation
- Different banner styles
- File output functionality
- Named Colors:
red,green,blue,yellow,purple,orange,pink,cyan,magenta,gray - RGB:
rgb(255,0,0)- Values from 0-255 - Hexadecimal:
#FF0000- 6-digit hex values - HSL:
hsl(0,100%,50%)- Hue (0-360), Saturation & Lightness (0-100%) - Color Mixing:
red,blue- Mix two colors
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
- The application automatically detects terminal width for proper text alignment
- Color output requires a terminal that supports ANSI color codes
- Banner files must be in the correct format for proper character rendering
β Star this repository if you found it helpful! β
Made with β€οΈ from πΈπ³