Categorygithub.com/go-mods/avatar
modulepackage
0.0.0-20240904200805-3803a50c51e4
Repository: https://github.com/go-mods/avatar.git
Documentation: pkg.go.dev

# README

avatar

GoDoc Go Report Card License

Avatar is a Go package that generates avatar from name.

Circle avatar

Square avatar

Custom avatar

Color palette from initial

Avatar server

Use docker to run the server:

docker build -t avatar-server .
docker run -t --rm -v ./assets:/avatar/assets -p 8080:8080 -d --name avatar-server avatar-server

or use docker-compose:

docker-compose build
docker-compose up -d

Generate an avatar

http://localhost:8080/api?name=John%20Doe
http://localhost:8080/api?name=John%20Doe&shape=square&width=200&height=200&backgroundColor=red&fontColor=white&fontFamily=Caprasimo&fontWeight=400&borderWidth=10&borderColor=blue&borderDash=10,10&borderRadius=50&padding=5

Options (query params) to use to customize the avatar initial

query parametertype
namestring
separatorstring
sensitivestring
lowercaseboolean
uppercaseboolean
camelcaseboolean
lengthnumber
wordLengthboolean

Options (query params) to use to customize the avatar

query parametertype
widthnumber
heightnumber
backgroundColorstring
fontFamilystring
fontWeightstring
fontSizenumber
fontColorstring
shapestring (circle, square)
borderDashstring (css border dash)
borderWidthnumber
borderRadiusnumber
borderColorstring
paddingnumber
randomFontColorboolean
randomBorderColorboolean

# Packages

No description provided by the author
No description provided by the author

# Functions

BackgroundColorFunc sets the background color generator function.
BorderColorFunc sets the border color generator function.
GetSVG returns the svg of a name.
NewColorGenerator returns a new colorGenerator.
TextColorFunc sets the text color generator function.
WithBackgroundColor sets the background color of the svg.
WithBackgroundColorFunc sets the background color function.
WithBorderColor sets the border color.
WithBorderColorFunc sets the border color function of the svg.
WithBorderDash sets the border style.
WithBorderRadius sets the border radius.
WithBorderWidth sets the border width.
WithFont sets the font of the svg.
WithFontColor sets the font color of the text.
WithFontColorFunc sets the font color function.
WithFontDir sets the directory for storing font files.
WithFontSize sets the font size of the text.
WithHeight sets the height of the svg.
WithPadding sets the padding.
WithRandomBackgroundColor sets the svg to be random background color.
WithRandomBorderColor sets the svg to be random border color.
WithRandomColor sets the svg to use random colors.
WithRandomFontColor sets the svg to be random font color.
WithShape sets the shape of the svg.
WithWidth sets the width of the svg.

# Type aliases

ColorFunc is function used to generate a color.
ColorOption is a function to set the colorGenerator options.
GeneratorOption is a function to set the avatarGenerator options.