geometric-avatar
is a Go package that effortlessly generates captivating geometric pattern avatars based on email hashes.
- ✅ Simplicity & Ease: Straightforward and effortless to use.
- 🎨 Customizable: Tailor avatars to your preference with a range of customization options.
- 🆙 Golang v1.27 Compatibility: Developed and optimized for Golang version 1.27.
To integrate the package, utilize go get
:
go get github.com/nawafinity/geometric-avatar
Below is an illustrative example of how to utilize the package in your code.
package main
import (
"fmt"
"github.com/nawafinity/geometric-avatar"
"image/color"
)
func main() {
email := "geometric-avatar"
options := map[string]interface{}{
"size": 128.0,
"margin": 0.08,
"background": color.RGBA{238, 238, 238, 255},
}
avatar := geometric_avatar.GenerateAvatar(email, options)
dc := avatar.Render()
// Save the avatar as a PNG file
err := dc.SavePNG("output.png")
if err != nil {
fmt.Println("Error:", err)
}
}
Discovered a bug or have a feature request? Please open a new issue