color

package
v0.0.0-...-124f97e Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2023 License: GPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	White       = T{1, 1, 1, 1}
	Black       = T{0, 0, 0, 1}
	Red         = T{1, 0, 0, 1}
	Green       = T{0, 1, 0, 1}
	Blue        = T{0, 0, 1, 1}
	Purple      = T{1, 0, 1, 1}
	Yellow      = T{1, 1, 0, 1}
	Cyan        = T{0, 1, 1, 1}
	Transparent = T{0, 0, 0, 0}
	None        = T{0, 0, 0, 0}

	DarkGrey = T{0.2, 0.2, 0.2, 1}
)

Predefined Colors

View Source
var DefaultPalette = RawPalette(
	0x24211e, 0x898377, 0xada99e, 0xcccac4, 0xf9f8f7,
	0x563735, 0x835748, 0xa37254, 0xb59669, 0xcab880,
	0x4d1c2d, 0x98191e, 0xd12424, 0xdd4b63, 0xf379e2,
	0xc86826, 0xd8993f, 0xe8c04f, 0xf2db89, 0xf8f1c6,
	0x17601f, 0x488c36, 0x7abd40, 0xa4cf41, 0xcdde5e,
	0x5044ba, 0x5e9ccc, 0x7fc6ce, 0x9de2df, 0xcaf1ea,
	0x202c56, 0x3f2d6d, 0x772673, 0xb9284f, 0xcb5135,
	0xeda7d8, 0xf3bedd, 0xdbebeb, 0xe9dde8, 0xd5c4df)

DefaultPalette https://lospec.com/palette-list/broken-facility

Functions

This section is empty.

Types

type Palette

type Palette []T

A Palette is a list of colors

func RawPalette

func RawPalette(colors ...int) Palette

RawPalette creates a palette from a list of hex integers

type T

type T struct {
	R, G, B, A float32
}

T holds 32-bit RGBA colors

func FromVec3

func FromVec3(v vec3.T) T

func FromVec4

func FromVec4(v vec4.T) T

func Hex

func Hex(s string) T

func Lerp

func Lerp(a, b T, f float32) T

Linearly interpolates between two colors

func RGB

func RGB(r, g, b float32) T

func RGB8

func RGB8(r, g, b uint8) T

func RGBA

func RGBA(r, g, b, a float32) T

Color4 creates a color struct from its RGBA components

func RGBA8

func RGBA8(r, g, b, a uint8) T

func Random

func Random() T

func (T) Byte4

func (c T) Byte4() byte4.T

func (T) Hex

func (c T) Hex() string

func (T) ImageData

func (c T) ImageData() *image.Data

func (T) Key

func (c T) Key() string

func (T) RGBA

func (c T) RGBA() color.RGBA

RGBA returns an 8-bit RGBA image/color

func (T) String

func (c T) String() string

func (T) TextureArgs

func (c T) TextureArgs() texture.Args

func (T) Vec3

func (c T) Vec3() vec3.T

Vec3 returns a vec3 containing the RGB components of the color

func (T) Vec4

func (c T) Vec4() vec4.T

Vec4 returns a vec4 containing the RGBA components of the color

func (T) Version

func (c T) Version() int

func (T) WithAlpha

func (c T) WithAlpha(a float32) T

WithAlpha returns a new color with a modified alpha value

Jump to

Keyboard shortcuts

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