Documentation ¶
Index ¶
- func Disabled(c color.NRGBA) (d color.NRGBA)
- func Hovered(c color.NRGBA) (d 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 NRGBAToRGBA_PostAlpha(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 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 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.
func NRGBAToRGBA_PostAlpha ¶
NRGBAToRGBA_PostAlpha 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