material

package
v5.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2026 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoColorFound = errors.New("no color found")

ErrNoColorFound means no color found from imput image.

Functions

func GenerateCustomColors

func GenerateCustomColors(primary color.ARGB) (map[string]CustomColor, error)

GenerateCustomColors returns all custom colors.

func GetPixelsFromImage

func GetPixelsFromImage(img image.Image) []color.ARGB

GetPixelsFromImage returns pixels from image.Imaget interface.

Types

type Colors

type Colors = map[string]color.ARGB

Colors is key and color.

func GenerateFromImage

func GenerateFromImage(
	ctx context.Context,
	img image.Image,
	cfg Config,
) (Colors, []color.ARGB, error)

GenerateFromImage colors from an image.Image.

func GenerateFromPixels

func GenerateFromPixels(
	ctx context.Context,
	pixels []color.ARGB,
	cfg Config,
) (Colors, []color.ARGB, error)

GenerateFromPixels generates color from a slice of pixels.

func GenerateFromQuantized

func GenerateFromQuantized(
	quantized Quantized,
	cfg Config,
) (Colors, []color.ARGB, error)

GenerateFromQuantized generates color from a cached quantized.

type Config

type Config struct {
	Variant   dynamic.Variant
	Platform  dynamic.Platform
	Version   dynamic.Version
	Dark      bool
	Constrast float64
}

Config is configuration used to generate colors.

func GetConfig

func GetConfig() Config

type CustomColor

type CustomColor struct {
	Color            color.ARGB
	OnColor          color.ARGB
	ColorContainer   color.ARGB
	OnColorContainer color.ARGB
}

CustomColor is colors generated from user defined colors.

type Quantized

type Quantized struct {
	Celebi map[color.ARGB]int `json:"celebi"`
	Wu     []color.ARGB       `json:"wu"`
}

Quantized is quantized colors.

func Quantize

func Quantize(ctx context.Context, pixels []color.ARGB) (Quantized, error)

Quantize quantizes list of pixels.

Jump to

Keyboard shortcuts

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