Go Boring Avatars
Go Boring Avatars is a tiny, zero-dependency go package that generates custom, SVG-based avatars from any username and color palette.
Install
go get github.com/hcarriz/go-boring-avatars
Usage
package main
import (
"io"
"log/slog"
"net/http"
"os"
"time"
goboringavatars "github.com/hcarriz/go-boring-avatars"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
avatar, _ := goboringavatars.New(time.Now().String())
w.Header().Set("Content-Type", "image/svg+xml; charset=utf-8")
io.WriteString(w, avatar)
})
if err := http.ListenAndServe(":8000", nil); err != nil {
slog.Error("closing server", slog.String("error", err.Error()))
os.Exit(1)
}
}
Config
See the docs for configuration options.