A simple and flexible library for generating GitHub-style identicon images in Go. Create unique, deterministic avatars for your users or projects.
- ✨ Generate unique identicons from any integer seed
- 🎨 Support for both color and grayscale output
- 🔧 Customizable image size and grid complexity
- 💪 Zero external dependencies
- 🚀 Simple, clean API
go get github.com/M1chlCZ/identicon-generator-go
package main
import (
"github.com/M1chlCZ/identicon-generator-go"
)
func main() {
// Generate with default settings
img := identicon.GenerateIdenticon(123)
identicon.SaveImage(img, "simple.png")
// Custom configuration
config := identicon.DefaultConfig()
config.Width = 800
config.Height = 800
config.GridSize = 7
config.Grayscale = true
img = identicon.GenerateIdenticonWithConfig(123, config)
identicon.SaveImage(img, "custom.png")
}
The repository includes a command-line tool for batch generating identicons:
go run cmd/main.go -w 500 -h 500 -grid 6 -count 10 -gray
-w
,-width
: Image width (default: 420)-h
,-height
: Image height (default: 420)-g
,-grid
: Grid size (default: 5)-c
,-count
: Number of images to generate (default: 150)-gray
: Generate grayscale images (default: false)
type Config struct {
Width int // Width of the generated image in pixels
Height int // Height of the generated image in pixels
GridSize int // Complexity of the pattern (e.g., 5 for 5x5 grid)
Grayscale bool // Whether to generate grayscale images
}
MIT License - feel free to use this in your own projects!
Contributions are welcome! Feel free to submit issues and pull requests.
Made with ❤️ in Go