avatargen

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: MPL-2.0 Imports: 7 Imported by: 0

README

Avatar Generator

Generates random pixel avatars of any size and any color.

Usage

Print to console
package main

import avatargen "github.com/1N1Group/avatar_gen"

func main() {
	avatar := avatargen.New()
	avatar.Print()
}
Result
                        
    ██  ██    ██  ██    
    ██            ██    
  ██    ████████    ██  
          ████          
      ████    ████      
  ██  ██  ████  ██  ██  
  ██  ████████████  ██  
    ██████    ██████    
      ██        ██      
  ████  ████████  ████  
                        
Write to file
package main

import (
	"os"

	avatargen "github.com/1N1Group/avatar_gen"
)

func main() {
	avatar := avatargen.New()
	buff := avatar.ToBuffer(1111)

	file, err := os.Create("img.jpeg")
	if err != nil {
		panic(err)
	}
	defer file.Close()

	buff.WriteTo(file)
}

Result

image

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Avatar

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

func New

func New() *Avatar

func (*Avatar) Generate

func (a *Avatar) Generate()

func (*Avatar) Print

func (a *Avatar) Print()

func (*Avatar) ToBuffer

func (a *Avatar) ToBuffer(size int) *bytes.Buffer

Jump to

Keyboard shortcuts

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