A Go program that converts strings into ASCII art with various styling options and features.
This ASCII Art Generator transforms text input into graphical ASCII art representations. It supports multiple banner styles, alignment options, color customization, and can even reverse ASCII art back to text.
This project serves as an immersive learning experience for mastering Go programming fundamentals through practical application. By building an ASCII art generator, we explore core Go concepts while creating something fun and useful.
- 📦 Package Management: Understanding Go modules and project structure
- 🔄 Control Structures: Mastering loops, conditionals, and program flow
- 📝 String Manipulation: Deep dive into string handling and rune operations
- 🔧 Error Handling: Implementing robust error checking and user feedback
- 📁 File Operations: Working with the Go file system API
- 🎯 Flag Parsing: Command-line argument handling in Go
- 🎨 ANSI Color Implementation: Terminal color manipulation
- 📏 Text Alignment Algorithms: String positioning and spacing calculations
- 🖥️ Terminal Manipulation: Working with terminal dimensions and output
- 🔄 Data Transformation: Converting between text and ASCII art representations
- Slices and arrays manipulation
- String and rune handling
- Interface implementation
- Error handling patterns
- Reading banner files
- Writing output to files
- File existence checking
- Error handling in file operations
- Multi-dimensional arrays for character representation
- Maps for character lookup
- Custom types and structs
- Text alignment algorithms
- Color parsing and application
- ASCII art conversion logic
- Terminal width adaptation
- Try implementing new banner styles
- Add support for new color formats
- Implement custom alignment algorithms
- Add animation features
- Optimize the program for large inputs
- 🎯 Multiple banner styles (standard, shadow, thinkertoy)
- 📏 Text alignment options (left, center, right, justify)
- 🌈 Color customization with RGB support
- 💾 Output to file functionality
- 🔄 Reverse ASCII art to text conversion
- 🔤 Support for letters, numbers, spaces, and special characters
# Clone the repository
git clone https://github.com/yassinalmach/string-to-ascii-art
cd string-to-ascii-art
# Build the project
go buildgo run . "Hello World"go run . "Hello World" shadowgo run . --output=example.txt "Hello World" thinkertoygo run . --align=center "Hello World" standard# Color specific letters
go run . --color=red He "Hello World"
# Using RGB values
go run . --color=rgb(255,0,0) world "Hello World"
# Color entire text
go run . --color=blue "Hello World"go run . --reverse=example.txt- white, black, red, green, blue, yellow, orange, pink, brown, purple
- RGB custom colors (0-255)
standardshadowthinkertoy
| Flag | Description |
|---|---|
--output=<fileName.txt> |
Save output to a file |
--align=<type> |
Set text alignment (left/center/right/justify) |
--color=<color> |
Apply color to text |
--reverse=<fileName> |
Convert ASCII art back to text |
The program includes proper error handling and usage messages for:
- Invalid flags or options
- File operations
- Color specifications
- Banner selection