Go implementation of the DiceBear avatar library. Generates deterministic SVG avatars from style definitions and a seed string.
DiceBear is available for multiple languages. All implementations share the same PRNG and rendering pipeline, producing identical SVG output for the same seed, style, and options, regardless of the language used.
go get github.com/dicebear/dicebear-go/v10Requires Go 1.23 or newer.
import (
dicebear "github.com/dicebear/dicebear-go/v10"
"github.com/dicebear/styles/v10"
)
// From a style definition (raw JSON, e.g. the pure-data styles module)
style, _ := dicebear.NewStyle([]byte(styles.Lorelei))
avatar, _ := dicebear.NewAvatar(style, map[string]any{
"seed": "John Doe",
"size": 128,
})
avatar.SVG() // SVG string
avatar.DataURI() // data:image/svg+xml;charset=utf-8,...style, _ := dicebear.NewStyle([]byte(styles.Lorelei))
// Create multiple avatars from the same style
avatar1, _ := dicebear.NewAvatar(style, map[string]any{"seed": "Alice"})
avatar2, _ := dicebear.NewAvatar(style, map[string]any{"seed": "Bob"})Advertisement: Many thanks to our sponsors who provide us with free or discounted products.