jdenticon

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2019 License: MIT Imports: 13 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Jdenticon-go

Golang library for generating highly recognizable identicons.

Sample identicons

License GoDoc Build Status Coverage Status Go Report Card

Features

Jdenticon-go is a golang port of the JavaScript library Jdenticon.

  • Renders identicons as SVG.

Live demo

https://jdenticon.com

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = &Config{
	Hues: -1,
	Colored: Color{
		Saturation: 0.5,
		Lightness:  []float64{0.4, 0.8},
	},
	Grayscale: Color{
		Saturation: 0.0,
		Lightness:  []float64{0.3, 0.9},
	},
	Background: color.RGBA{0xff, 0xff, 0xff, 0x00},
	Width:      200,
	Height:     200,
	Padding:    0.08,
}

DefaultConfig var

Functions

This section is empty.

Types

type Circle

type Circle struct {
	Center    Point
	Radius    float64
	Clockwise bool
}

func (*Circle) Copy

func (c *Circle) Copy() Shape

func (*Circle) Path

func (c *Circle) Path() string

func (*Circle) Rotate

func (c *Circle) Rotate(deg float64, center *Point)

func (*Circle) Translate

func (c *Circle) Translate(dx, dy float64)

type Color

type Color struct {
	Lightness  []float64
	Saturation float64
}

type Config

type Config struct {
	Hues       int
	Colored    Color
	Grayscale  Color
	Background color.Color
	Width      int
	Height     int
	Padding    float64
}

func ConfigFromBytes

func ConfigFromBytes(h []byte) (c *Config, err error)

func ConfigFromString

func ConfigFromString(h string) (c *Config, err error)

type Jdenticon

type Jdenticon interface {
	SVG() ([]byte, error)
}

func New

func New(identity string) Jdenticon

func NewWithConfig

func NewWithConfig(identity string, c *Config) Jdenticon

type Path

type Path struct {
	XMLName    xml.Name `xml:"path"`
	Shapes     Shapes   `xml:"d,attr"`
	Fill       string   `xml:"fill,attr,omitempty"`
	Opacity    float64  `xml:"opacity,attr,omitempty"`
	Stroke     string   `xml:"stroke,attr,omitempty"`
	UseOpacity bool     `xml:"-"`
}

func (Path) MarshalXML

func (p Path) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type Paths

type Paths []Path

type Point

type Point struct {
	X float64
	Y float64
}

func (*Point) Path

func (p *Point) Path() string

func (*Point) Translate

func (p *Point) Translate(dx, dy float64)

type Polygon

type Polygon struct {
	Points    []Point
	Clockwise bool
}

func (*Polygon) Copy

func (s *Polygon) Copy() Shape

func (*Polygon) Path

func (s *Polygon) Path() string

func (*Polygon) Rotate

func (s *Polygon) Rotate(deg float64, center *Point)

func (*Polygon) Translate

func (s *Polygon) Translate(dx, dy float64)

type SVG

type SVG struct {
	XMLName             xml.Name `xml:"svg"`
	Width               int      `xml:"width,attr"`
	Height              int      `xml:"height,attr"`
	PreserveAspectRatio string   `xml:"preserveAspectRatio,attr"`
	ViewBox             string   `xml:"viewBox,attr"`
	Namespace           string   `xml:"xmlns,attr"`
	Paths               `xml:"path"`
}

type Shape

type Shape interface {
	Path() string
	Rotate(deg float64, center *Point)
	Translate(dx, dy float64)
	Copy() Shape
}

type Shapes

type Shapes []Shape

func (Shapes) String

func (shapes Shapes) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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