govatar

package module
v0.0.0-...-21facac Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2018 License: MIT Imports: 6 Imported by: 0

README

govatar

Govatar is a silly little program written in Golang that generates a unique avatar, complete with a unique color scheme, based on any text string. The main aim was to create a slightly more visually interesting version of Identicons. Although govatars do contain all of the originally provided information like Identicons do, it is much harder to retrieve. They are only meant for use as account avatars, not as data storage.

Usage

To use call the CreateAvatar function, passing the width and height of the canvas, the width and height of each "block", the user name (or any string) that you want the govatar to be based on, a salt string used to generate hash and the desired vibrance (recommended value of four).

Block width and height should be divisors of canvas width and height. The salt used should be equal in length to the number of blocks being rendered (half of the total blocks). For example on a 128 x 128 canvas with 16 x 16 blocks the salt should be a string with a length of 32. If you want to use special characters please remember to encode them properly.

If you only require basic functionality then there is an API available here.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAvatar

func CreateAvatar(canvasWidth, canvasHeight, blockWidth, blockHeight int, vibrance uint8, userName, salt string) (image.Image, error)

Create the avatar and return as image.Image

func Hash

func Hash(userName, salt string) ([]byte, error)

Generates a hashed byte array based on username and salt

func Shuffle

func Shuffle(vals []uint8, colorInt int64)

Shuffles a uint8 array

Types

This section is empty.

Jump to

Keyboard shortcuts

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