geometric_avatar

package module
v0.0.0-...-dd97079 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2023 License: MIT Imports: 5 Imported by: 0

README

geometric-avatar

geometric-avatar is a Go package that effortlessly generates captivating geometric pattern avatars based on email hashes.


GitHub Sponsors donate button GitHub Sponsors donate button

Changelog | العربية

Features

  • Simplicity & Ease: Straightforward and effortless to use.
  • 🎨 Customizable: Tailor avatars to your preference with a range of customization options.
  • 🆙 Golang v1.27 Compatibility: Developed and optimized for Golang version 1.27.

Installation

To integrate the package, utilize go get:

go get github.com/nawafinity/geometric-avatar

Usage

Below is an illustrative example of how to utilize the package in your code.

package main

import (
	"fmt"
	"github.com/nawafinity/geometric-avatar"
	"image/color"
)

func main() {
	email := "geometric-avatar"
	options := map[string]interface{}{
		"size":       128.0,
		"margin":     0.08,
		"background": color.RGBA{238, 238, 238, 255},
	}

	avatar := geometric_avatar.GenerateAvatar(email, options)
	dc := avatar.Render()

	// Save the avatar as a PNG file
	err := dc.SavePNG("output.png")
	if err != nil {
		fmt.Println("Error:", err)
	}
}

Sponsor

Become a Sponsor

Bugs and Feature Requests

Discovered a bug or have a feature request? Please open a new issue

License

MIT License

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateHashFromString

func CreateHashFromString(str string) string

Types

type Avatar

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

func GenerateAvatar

func GenerateAvatar(email string, options map[string]interface{}) *Avatar

func (*Avatar) Render

func (ig *Avatar) Render() *gg.Context

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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