color

package
v0.0.0-...-1392edb Latest Latest
Warning

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

Go to latest
Published: May 11, 2019 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RGB

type RGB struct {
	R int `json:"r"`
	G int `json:"g"`
	B int `json:"b"`
}

RGB holds RGB values (0-255, although they can be negative in the case of a delta)

func GetRGBFromColorful

func GetRGBFromColorful(c colorful.Color) RGB

GetRGBFromColorful turns a colorful.Color struct into an RGB one

func GetRGBFromString

func GetRGBFromString(s string) RGB

GetRGBFromString turns a string into an RGB color The input can either be hex (#00FF00) or a string (green)

func (*RGB) AsColorful

func (c *RGB) AsColorful() colorful.Color

AsColorful turns a colorful.Color into an RGB

func (*RGB) AsComponents

func (c *RGB) AsComponents() (int, int, int)

AsComponents returns the seperate r, g, b

func (*RGB) AsPB

func (c *RGB) AsPB() pb.RGB

AsPB returns the RGB color as a protobuf RGB

func (*RGB) GetInterpolatedFade

func (c *RGB) GetInterpolatedFade(target RGB, step, numSteps int) RGB

GetInterpolatedFade returns fade from one color to another.

func (*RGB) GetXyy

func (c *RGB) GetXyy() (x, y, Yout float64)

GetXyy returns the RGB color in xyy color space

func (*RGB) IsBlack

func (c *RGB) IsBlack() bool

IsBlack determines if a color is black

func (*RGB) TermString

func (c *RGB) TermString() string

TermString returns a ANSI-color formatted r/g/b string

func (*RGB) ToHex

func (c *RGB) ToHex() string

ToHex converts a color to hex

Jump to

Keyboard shortcuts

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