colormind

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrURLParse       = errors.New("parsing URL")
	ErrGet            = errors.New("executing get request")
	ErrResponseStatus = errors.New("invalid response status")
	ErrReadBody       = errors.New("reading response body")
	ErrParseBody      = errors.New("parsing response body")
	ErrPost           = errors.New("executing post request")
	ErrEmptyBody      = errors.New("response has empty body")
	ErrValidation     = errors.New("validation error")
	ErrEmptyPalette   = errors.New("palette may not be empty")
)

Functions

func PaletteQueue

func PaletteQueue(ctx context.Context, model string, cm *ColorMind, chanSize int) (chan *color.RGBA, chan error)

Types

type Color

type Color color.RGBA

func (*Color) Marshal

func (c *Color) Marshal() ([]byte, error)

func (*Color) Unmarshal

func (c *Color) Unmarshal(v []byte) error

type ColorMind

type ColorMind struct {
	URL    string
	Client *http.Client
}

func New

func New() *ColorMind

func (*ColorMind) GetPalette

func (c *ColorMind) GetPalette(model string, p *Palette) (*Palette, error)

func (*ColorMind) GetPaletteWithContext

func (c *ColorMind) GetPaletteWithContext(ctx context.Context, model string, p *Palette) (*Palette, error)

func (*ColorMind) ListModels

func (c *ColorMind) ListModels() ([]string, error)

func (*ColorMind) ListModelsWithContext

func (c *ColorMind) ListModelsWithContext(ctx context.Context) ([]string, error)

type Palette

type Palette [5]*color.RGBA

func (*Palette) MarshalJSON

func (p *Palette) MarshalJSON() ([]byte, error)

func (*Palette) UnmarshalJSON

func (p *Palette) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

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