avatars

package module
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 25, 2024 License: MIT Imports: 10 Imported by: 0

README

go-avatars

Go library for avatar generation.

Based on @dicebear

Supports SVG and PNG output.

Sample generated by main.go

sample

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Avatar added in v0.3.0

type Avatar struct {
	// contains filtered or unexported fields
}

Avatar that was generated using specified seed.

func Generate added in v0.3.0

func Generate(name string, opts ...Option) (*Avatar, error)

Generate an avatar using the given name as seed.

func (*Avatar) Image added in v0.3.0

func (a *Avatar) Image(opts ...RenderOption) (image.Image, error)

Image rendered from the SVG.

func (*Avatar) Name added in v0.3.0

func (a *Avatar) Name() string

Name of the avatar.

func (*Avatar) PNG added in v0.3.0

func (a *Avatar) PNG(opts ...RenderOption) ([]byte, error)

PNG encoded image.

func (*Avatar) SVG added in v0.3.0

func (a *Avatar) SVG() []byte

SVG content of the avatar.

type Option added in v0.2.0

type Option interface {
	// contains filtered or unexported methods
}

Option is a function that applies an option to the avatar service.

type Options added in v0.2.0

type Options struct{}

Options for the avatar service.

type RenderOption added in v0.3.0

type RenderOption interface {
	// contains filtered or unexported methods
}

Render is a function that applies a render option to the avatar service.

type RenderOptions added in v0.3.0

type RenderOptions struct {
	// Size of the rendered avatar.
	Size int
	// Padding between the rendered avatar and the border.
	Padding int
}

RenderOptions is a set of options for rendering an avatar.

type RenderPadding added in v0.3.0

type RenderPadding int

RenderPadding sets the padding between the rendered avatar and the border.

type RenderSize added in v0.2.0

type RenderSize int

RenderSize sets the size of the rendered avatar in pixels.

Directories

Path Synopsis
example

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL