RGB#
func RGB(red, green, blue uint8) ColorRGB is an opaque color from its 8-bit channels.
type Color struct {
Red float32
Green float32
Blue float32
Alpha float32
}Color is a linear RGBA color.
RGB#func RGB(red, green, blue uint8) ColorRGB is an opaque color from its 8-bit channels.
RGB24#func RGB24(rgb uint32) ColorRGB24 is an opaque color from 0xRRGGBB, as a design tool or a stylesheet writes it: ui.RGB24(0x0a84ff). The number is an integer constant, so the compiler checks and folds it: there is no string to parse and no error to handle.
RGBA#func RGBA(red, green, blue uint8, alpha float32) ColorRGBA is a color from its 8-bit channels and an alpha between 0 and 1.
Mix#func (color Color) Mix(other Color, t float32) ColorMix interpolates from color to other in premultiplied alpha, like CSS color transitions, so a fade to a translucent color does not pass through a darker or lighter fringe. The end points are returned exactly.
Over#func (color Color) Over(backdrop Color) ColorOver composites color onto backdrop with ordinary alpha blending, the same arithmetic the GPU applies when both are drawn, and returns the result. A recipe uses it to flatten a translucent token before handing it to Canvas.RoundedBorder, which paints its border color as a solid backing shape: left translucent, that color would tint the whole interior.
WithAlpha#func (color Color) WithAlpha(alpha float32) ColorWithAlpha is the color with another alpha between 0 and 1; its channels are kept.