godenticon

package module
v0.0.0-...-9a029d3 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2019 License: MIT Imports: 4 Imported by: 0

README

Godenticon

Godenticon is a tiny package that generates identicons based on the hash of provided data. It is inspired by Pydenticon

Example

// Calculate MD5 checksum of the data
hash := md5.Sum([]byte("Gopher!"))

// Create an image using hash and slice of colours 
img, _ := g.GenarateImage(hash, g.ColorGopher)

// Create a new file to be written down a specified path 
f, _ := os.Create("image.png")

// Write image into a file
g.SaveImage(img, f)

It will output image:

Gopher!

License

This project is licensed under the MIT License - see the LICENSE file for details

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ColorBlues = []color.Color{
	color.RGBA{0, 0, 32, 0xff},
	color.RGBA{0, 32, 64, 0xff},
	color.RGBA{0, 64, 96, 0xff},
	color.RGBA{0, 96, 128, 0xff},
	color.RGBA{0, 112, 144, 0xff},
	color.RGBA{63, 104, 150, 0xff},
	color.RGBA{106, 151, 193, 0xff},
	color.RGBA{138, 173, 221, 0xff},
	color.RGBA{32, 67, 116, 0xff},
	color.RGBA{143, 185, 255, 0xff},
}

ColorBlues ...

View Source
var ColorDiscord = []color.Color{
	color.RGBA{128, 128, 128, 0xff},
	color.RGBA{96, 96, 96, 0xff},
	color.RGBA{64, 64, 64, 0xff},
	color.RGBA{32, 32, 32, 0xff},
	color.RGBA{1, 1, 1, 0xff},
	color.RGBA{72, 75, 81, 0xff},
	color.RGBA{54, 57, 63, 0xff},
	color.RGBA{47, 49, 54, 0xff},
	color.RGBA{42, 44, 49, 0xff},
	color.RGBA{32, 34, 37, 0xff},
}

ColorDiscord ...

View Source
var ColorGopher = []color.Color{
	color.RGBA{100, 200, 200, 0xff},
}

ColorGopher ...

View Source
var ColorNeon = []color.Color{
	color.RGBA{2, 254, 0, 0xff},
	color.RGBA{0, 224, 0, 0xff},
	color.RGBA{0, 192, 0, 0xff},
	color.RGBA{0, 192, 0, 0xff},
	color.RGBA{0, 160, 0, 0xff},
	color.RGBA{0, 128, 0, 0xff},
	color.RGBA{126, 255, 0, 0xff},
	color.RGBA{70, 195, 76, 0xff},
	color.RGBA{71, 159, 120, 0xff},
	color.RGBA{207, 255, 177, 0xff},
}

ColorNeon ...

View Source
var ColorSunny = []color.Color{
	color.RGBA{241, 220, 6, 0xff},
	color.RGBA{244, 244, 10, 0xff},
	color.RGBA{244, 255, 0, 0xff},
	color.RGBA{255, 210, 0, 0xff},
	color.RGBA{233, 243, 15, 0xff},
	color.RGBA{249, 156, 0, 0xff},
	color.RGBA{255, 167, 20, 0xff},
	color.RGBA{255, 202, 22, 0xff},
	color.RGBA{255, 178, 27, 0xff},
	color.RGBA{249, 115, 0, 0xff},
}

ColorSunny ...

Functions

func GenarateImage

func GenarateImage(hash [16]byte, colorPalette []color.Color) (*image.RGBA, error)

GenarateImage creates image based on [16]byte hash and color slice

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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