color

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2022 License: MIT Imports: 6 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Palette []RGB
)

Functions

func PaletteColorNames

func PaletteColorNames() []string

func SetLogger added in v0.3.0

func SetLogger(newlogger logger.Logger)

Types

type Color

type Color interface {
	HSL() HSL
	HSV() HSV
	RGB() RGB
	RGBA() (r, g, b, a uint32)
	Equal(c Color) bool
}

func FromStdColor added in v0.4.0

func FromStdColor(c color.Color) Color

type HSL

type HSL struct {
	H    uint16
	S, L uint8
}

func (HSL) Equal

func (c HSL) Equal(col Color) bool

func (HSL) HSL

func (c HSL) HSL() HSL

func (HSL) HSV

func (c HSL) HSV() HSV

func (HSL) IsSame

func (l HSL) IsSame(r HSL) bool

func (HSL) RGB

func (c HSL) RGB() RGB

func (HSL) RGBA

func (c HSL) RGBA() (r, g, b, a uint32)

type HSV

type HSV struct {
	H    uint16
	S, V uint8
}

func (HSV) Equal

func (hv HSV) Equal(col Color) bool

func (HSV) HSL

func (hv HSV) HSL() HSL

func (HSV) HSV

func (hv HSV) HSV() HSV

func (HSV) IsSame

func (hv HSV) IsSame(r HSV) bool

func (HSV) Lerp

func (hv HSV) Lerp(to HSV, t float32) HSV

func (HSV) RGB

func (hv HSV) RGB() RGB

func (HSV) RGBA

func (hv HSV) RGBA() (r, g, b, a uint32)

type Mode

type Mode int

Mode x ENUM(effect, hs, ct)

const (
	// Effect is a Mode of type Effect
	Effect Mode = iota
	// Hs is a Mode of type Hs
	Hs
	// Ct is a Mode of type Ct
	Ct
)

func ParseMode

func ParseMode(name string) (Mode, error)

ParseMode attempts to convert a string to a Mode

func (Mode) String

func (i Mode) String() string

type PaletteColor

type PaletteColor int

Color x ENUM( Red, Orange, Yellow, YellowGreen, Green, CyanGreen, Cyan, CyanBlue, Blue, Purple, Magenta, MagentaRed, White, Black, LightGray, Gray, DarkGray, Transparent, )

const (
	// Red is a PaletteColor of type Red
	Red PaletteColor = iota
	// Orange is a PaletteColor of type Orange
	Orange
	// Yellow is a PaletteColor of type Yellow
	Yellow
	// YellowGreen is a PaletteColor of type YellowGreen
	YellowGreen
	// Green is a PaletteColor of type Green
	Green
	// CyanGreen is a PaletteColor of type CyanGreen
	CyanGreen
	// Cyan is a PaletteColor of type Cyan
	Cyan
	// CyanBlue is a PaletteColor of type CyanBlue
	CyanBlue
	// Blue is a PaletteColor of type Blue
	Blue
	// Purple is a PaletteColor of type Purple
	Purple
	// Magenta is a PaletteColor of type Magenta
	Magenta
	// MagentaRed is a PaletteColor of type MagentaRed
	MagentaRed
	// White is a PaletteColor of type White
	White
	// Black is a PaletteColor of type Black
	Black
	// LightGray is a PaletteColor of type LightGray
	LightGray
	// Gray is a PaletteColor of type Gray
	Gray
	// DarkGray is a PaletteColor of type DarkGray
	DarkGray
	// Transparent is a PaletteColor of type Transparent
	Transparent
)

func Colors

func Colors() []PaletteColor

func ParsePaletteColor

func ParsePaletteColor(name string) (PaletteColor, error)

ParsePaletteColor attempts to convert a string to a PaletteColor

func (PaletteColor) Equal

func (c PaletteColor) Equal(col Color) bool

func (PaletteColor) HSL

func (c PaletteColor) HSL() HSL

func (PaletteColor) HSV

func (c PaletteColor) HSV() HSV

func (PaletteColor) Lerp

func (c PaletteColor) Lerp(to Color, t float32) Color

func (PaletteColor) RGB

func (c PaletteColor) RGB() RGB

func (PaletteColor) RGBA

func (c PaletteColor) RGBA() (r, g, b, a uint32)

func (PaletteColor) String

func (i PaletteColor) String() string

type RGB

type RGB color.RGBA

func (RGB) Equal

func (rc RGB) Equal(r Color) bool

func (RGB) HSL

func (rc RGB) HSL() HSL

func (RGB) HSV

func (rc RGB) HSV() HSV

func (RGB) IsSame

func (rc RGB) IsSame(r RGB) bool

func (RGB) Lerp

func (rc RGB) Lerp(to Color, t float32) RGB

func (RGB) Lightness

func (rc RGB) Lightness() uint8

func (RGB) RGB

func (rc RGB) RGB() RGB

func (RGB) RGBA

func (rc RGB) RGBA() (r, g, b, a uint32)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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