Skip to content

Latest commit

 

History

20 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

idicon

About

After checking with the official docker golang container releases, I can say with some confidence idicon works with golang versions 1.2+.

go get github.com/GeorgeMac/idicon/cmd/idicon

See: idicon command for command usage.

lib usage

Basically this:

generator, err := icon.NewGenerator(5, 5)
if err != nil {
    // handle error
}

// use the generator for a given string input
icn := generator.Generate(`GeorgeMac`)

// print svg string representation
fmt.Print(icn)

icon.NewGenerator(...) Usage

NewGenerator produces a idicon icon generator struct for producing *icon.Icon It takes a width, height and an variadic set of options.

type option func(g *Generator) error

func NewGenerator(width, height int, options ...option) *Generator { ... }

Current available options include:

icon.UseHash(h hash.Hash) // Defaults to crypto.Sha1.New
icon.LinearDistribution // Different way of indexing flipped bits
icon.With(props icon.Props) // SVG output properties

icon.Props{} Usage

type Props struct {
	BaseColour   *colour.Colour
	Palette      colour.Palette
	Size         int
	Padding      int
	BorderRadius int
}
  1. BaseColour - background colour
  2. Palette - colour palette for deriving svg square colours
  3. Size - width/height of an individual svg square
  4. Padding - padding around the svg grid of squares
  5. BorderRadius - for those pretty curved corners

About

golang identicon lib + command line printing tool

Resources

Stars

8 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages