This section is empty.


This section is empty.


func Disabled

func Disabled(c color.NRGBA) (d color.NRGBA)

Disabled blends color towards the luminance and multiplies alpha. Blending towards luminance will desaturate the color. Multiplying alpha blends the color together more with the background.

func Hovered

func Hovered(c color.NRGBA) (d color.NRGBA)

Hovered blends color towards a brighter color.

func MulAlpha

func MulAlpha(c color.NRGBA, alpha uint8) color.NRGBA

MulAlpha applies the alpha to the color.

func NRGBAToLinearRGBA

func NRGBAToLinearRGBA(col color.NRGBA) color.RGBA

NRGBAToLinearRGBA converts from non-premultiplied sRGB color to premultiplied linear RGBA color.

Each component in the result is `c * alpha`, where `c` is the linear color.


func NRGBAToRGBA(col color.NRGBA) color.RGBA

NRGBAToRGBA converts from non-premultiplied sRGB color to premultiplied sRGB color.

Each component in the result is `sRGBToLinear(c * alpha)`, where `c` is the linear color.


func RGBAToNRGBA(col color.RGBA) color.NRGBA

RGBAToNRGBA converts from premultiplied sRGB color to non-premultiplied sRGB color.


type RGBA

type RGBA struct {
	R, G, B, A float32

RGBA is a 32 bit floating point linear premultiplied color space.

func LinearFromSRGB

func LinearFromSRGB(col color.NRGBA) RGBA

LinearFromSRGB converts from col in the sRGB colorspace to RGBA.

func (RGBA) Array

func (rgba RGBA) Array() [4]float32

Array returns rgba values in a [4]float32 array.

func (RGBA) Float32

func (col RGBA) Float32() (r, g, b, a float32)

Float32 returns r, g, b, a values.

func (RGBA) Luminance

func (col RGBA) Luminance() float32

Luminance calculates the relative luminance of a linear RGBA color. Normalized to 0 for black and 1 for white.

See for more details

func (RGBA) Opaque

func (col RGBA) Opaque() RGBA

Opaque returns the color without alpha component.

func (RGBA) SRGB

func (col RGBA) SRGB() color.NRGBA

SRGBA converts from linear to sRGB color space.

Source Files