identicon

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2021 License: MIT Imports: 6 Imported by: 0

README

Stellar Identicon Generator (Golang)

The go implementation of SEP-0033, which you can use to generate identicons for Stellar wallets - unique icons, generated based on the wallet public key.

You can also access online API through Stellar Identicon Generate API (source).

Install

go get -u github.com/StellarCN/stellar-identicon-go

Usage

import identicon "github.com/StellarCN/stellar-identicon-go"

func main() {
publicKey := "GAQL4ZLRIJBGSCXE6XC4XPZ5W6FGCJHXLAMB4M7ZQ52HFPDTL6GSVP4W"
img, err := identicon.Generate(publicKey, identicon.Width, identicon.Height)
if err != nil {

}

Thanks

This project was inspired by LOBSTR.

Documentation

Overview

Package stellar_identicon provides a way to generate identicons for Stellar accounts.

Index

Constants

View Source
const (
	// Default width of resulting identicon image in pixels
	Width = 210
	// Default height of resulting identicon image in pixels
	Height = 210
)

Variables

View Source
var InvalidEd25519PublicKeyError = errors.New("invalid ed25519 public key")

This exception will be thrown when an invalid address is used

Functions

func Generate

func Generate(publicKey string, width, height int) (*image.RGBA, error)

Generates an identicon for the given stellar address

Types

type HSV

type HSV struct {
	H, S, V float64
}

func (*HSV) RGB

func (c *HSV) RGB() *RGB

type RGB

type RGB struct {
	R, G, B float64
}

Jump to

Keyboard shortcuts

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