package f32color
import "gioui.org/internal/f32color"
Index ¶
- 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
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 MulAlpha ¶
MulAlpha applies the alpha to the color.
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 RGBAToNRGBA ¶
RGBAToNRGBA converts from premultiplied sRGB color to non-premultiplied sRGB 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) Array ¶
Array returns rgba values in a [4]float32 array.
func (RGBA) Float32 ¶
Float32 returns r, g, b, a values.
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
func (RGBA) Opaque ¶
Opaque returns the color without alpha component.
func (RGBA) SRGB ¶
SRGBA converts from linear to sRGB color space.
Source Files ¶
rgba.go tables.go
Directories ¶
Path | Synopsis |
---|---|
internal/f32color/f32colorgen |
- Version
- v0.8.0 (latest)
- Published
- Jan 14, 2025
- Platform
- linux/amd64
- Imports
- 2 packages
- Last checked
- 3 hours ago –
Tools for package owners.