The Letter Avatar Generator is a Go application designed to create personalized avatars using the first letter of a user's name. Users have the flexibility to choose background colors, avatar shapes, size and the file format for saving the generated avatar. This project utilizes the letteravatarapi
custom package for generating images with a letter set against a customizable background, making it ideal for creating unique avatars for various online platforms.
- Users can choose a background color from predefined options.
- Shape selection allows for either a circle or square avatar.
- Size customization enables specifying the avatar dimension within a range.
- Supports saving the avatar in either PNG or JPG formats.
- Go (version 1.15 or newer is recommended)
- The
gg
package for Go graphics
Ensure you have Go installed on your system by downloading it from the official Go website.
Clone the repository to begin using the Letter Avatar Generator:
git clone https://github.com/modevsty/go-letteravatar.git
cd go-letteravatar
Install the required Go package:
go get github.com/fogleman/gg
To run the application, navigate to the project directory and build the application:
go build
Then run the following command:
./letteravatar
The application will guide you through a series of prompts:
- Enter Your Name: Input your first and last name only.
- Pick a Background Color: Choose from the list by entering the corresponding number.
- Pick a Shape: Select your preferred shape for the avatar.
- Pick a Size: Specify the avatar's size (in pixels), which must be between 16 and 1024.
- Pick a Save Format: Choose between PNG or JPG formats for your avatar.
- After these selections, the program generates your avatar according to your specifications and saves it in the current directory.
The letteravatarapi allows for customization of the avatar's shape, size, and colors. Here are some methods you can use:
- WithShape("circle" or "rectangle"): Defines the shape of the avatar.
- WithSize(int): Sets the size of the avatar.
- WithColor(bgColorHex string): Sets the background color.
These methods can be chained together when creating a new LetterAvatar instance.
We welcome contributions to the Letter Avatar Generator project. Feel free to fork the repository, make your changes, and submit a pull request. For any issues or suggestions, please open an issue in the GitHub repository.