Documentation ¶
Index ¶
- func BlendSRGBA(p float32, a, b color.NRGBA) color.NRGBA
- func Disabled(c color.NRGBA) (d color.NRGBA)
- func Hovered(c color.NRGBA) (h color.NRGBA)
- func MulAlpha(c color.NRGBA, alpha uint8) color.NRGBA
- func NRGBAToLinearRGBA(col color.NRGBA) color.RGBA
- func NRGBAToRGBA(col color.NRGBA) color.RGBA
- func RGBAToNRGBA(col color.RGBA) color.NRGBA
- type RGBA
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BlendSRGBA ¶
BlendSRGBA blends to colors in sRGB color space.
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