gioui_hashicon

package module
v0.0.0-...-36a79b2 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2024 License: MIT Imports: 8 Imported by: 2

README

Gio UI Hashicon

This is a GO port of a pretty javascript canvas hashicon https://github.com/emeraldpay/hashicon.
Full credit to the original creator and contributors.

Hashicons image

Usage

go get gioui-hashicon


import "github.com/g45t345rt/gioui-hashicon"

hash := "9dddff8f-be81-4c27-80c8-099327865f3f"
size := 100

// use this inside the GIO render loop
Hashicon{Config: DefaultConfig}.Layout(gtx, size, hash)

Check the example folder for a detailed usage.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	HashKey:    "emerald/hashicon",
	Hue:        MinMaxValue{Min: 0, Max: 360},
	Saturation: MinMaxValue{Min: 70, Max: 100},
	Lightness:  MinMaxValue{Min: 45, Max: 65},
	Variation: VariationValue{
		MinMax: MinMaxValue{
			Min: 5, Max: 20,
		},
		Enabled: true,
	},
	Shift:       MinMaxValue{Min: 60, Max: 300},
	FigureAlpha: MinMaxValue{Min: .7, Max: 1.2},
	Light: LightValue{
		Map: map[Light]float64{
			Top:   10,
			Right: -8,
			Left:  -4,
		},
		Enabled: true,
	},
}
View Source
var Figures = [][28]int{}/* 254 elements not displayed */
View Source
var Shapes = []Triangle{
	{/* contains filtered or unexported fields */},
	{/* contains filtered or unexported fields */},
}
View Source
var Sprites = []Sprite{
	{/* contains filtered or unexported fields */},
	{/* contains filtered or unexported fields */},
	{/* contains filtered or unexported fields */},
	{/* contains filtered or unexported fields */},
	{/* contains filtered or unexported fields */},
	{/* contains filtered or unexported fields */},
	{/* contains filtered or unexported fields */},

	{/* contains filtered or unexported fields */},
	{/* contains filtered or unexported fields */},
	{/* contains filtered or unexported fields */},
	{/* contains filtered or unexported fields */},
	{/* contains filtered or unexported fields */},
	{/* contains filtered or unexported fields */},
	{/* contains filtered or unexported fields */},

	{/* contains filtered or unexported fields */},
	{/* contains filtered or unexported fields */},
	{/* contains filtered or unexported fields */},
	{/* contains filtered or unexported fields */},
	{/* contains filtered or unexported fields */},
	{/* contains filtered or unexported fields */},
	{/* contains filtered or unexported fields */},

	{/* contains filtered or unexported fields */},
	{/* contains filtered or unexported fields */},
	{/* contains filtered or unexported fields */},
	{/* contains filtered or unexported fields */},
	{/* contains filtered or unexported fields */},
	{/* contains filtered or unexported fields */},
	{/* contains filtered or unexported fields */},
}

Functions

This section is empty.

Types

type Config

type Config struct {
	HashKey     string
	Hue         MinMaxValue
	Saturation  MinMaxValue
	Lightness   MinMaxValue
	Variation   VariationValue
	Shift       MinMaxValue
	FigureAlpha MinMaxValue
	Light       LightValue
}

type Hashicon

type Hashicon struct {
	Config Config
}

func (Hashicon) Layout

func (r Hashicon) Layout(gtx layout.Context, size float32, hash string) layout.Dimensions

type Light

type Light string
const (
	Top   Light = "top"
	Left  Light = "left"
	Right Light = "right"
)

type LightValue

type LightValue struct {
	Map     map[Light]float64
	Enabled bool
}

type MinMaxValue

type MinMaxValue struct {
	Min float64
	Max float64
}

type Sprite

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

type Triangle

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

type VariationValue

type VariationValue struct {
	MinMax  MinMaxValue
	Enabled bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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