An open API service indexing awesome lists of open source software.

https://github.com/dicebear/dicebear-go

Go implementation of DiceBear. Read-only subtree split of dicebear/dicebear - please open issues there.
https://github.com/dicebear/dicebear-go

Last synced: 1 day ago
JSON representation

Go implementation of DiceBear. Read-only subtree split of dicebear/dicebear - please open issues there.

Awesome Lists containing this project

README

          


DiceBear Core (Go)

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.

[Playground](https://www.dicebear.com/playground) |
[Documentation](https://www.dicebear.com/how-to-use/go-library/)

## Installation

```sh
go get github.com/dicebear/dicebear-go/v10
```

Requires Go 1.23 or newer.

## Usage

```go
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,...
```

### Using the Style type

```go
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"})
```

## Sponsors

Advertisement: Many thanks to our sponsors who provide us with free or
discounted products.





bunny.net