Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Disabled ¶
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 ¶
Hovered blends dark colors towards white, and light colors towards black. It is approximate because it operates in non-linear sRGB space.
func NRGBAToLinearRGBA ¶
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 ¶
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.
Types ¶
type RGBA ¶
type RGBA struct {
R, G, B, A float32
}
RGBA is a 32 bit floating point linear premultiplied color space.
func LinearFromSRGB ¶
LinearFromSRGB converts from col in the sRGB colorspace to RGBA.
func (RGBA) Luminance ¶
Luminance calculates the relative luminance of a linear RGBA color. Normalized to 0 for black and 1 for white.
See https://www.w3.org/TR/WCAG20/#relativeluminancedef for more details