RGBA color representation for terminal UI rendering.
Colors are stored as 4-tuples {r, g, b, a} where each component is 0-255. Alpha channel is used for opacity/blending calculations.
Summary
Functions
Alpha-blend fg over bg. Standard Porter-Duff "source over" compositing.
Parse a hex color string like '#FF0000' or '#FF0000FF'.
Create an opaque RGB color from HSL values.
Create an RGB color with full opacity.
Create an RGBA color.
Convert to ANSI 24-bit background escape sequence.
Convert to ANSI 24-bit foreground escape sequence.
Apply opacity (0.0-1.0) to a color by scaling its alpha.
Types
Functions
Alpha-blend fg over bg. Standard Porter-Duff "source over" compositing.
Parse a hex color string like '#FF0000' or '#FF0000FF'.
Create an opaque RGB color from HSL values.
Hue is in degrees (0-360, wraps), saturation and lightness are 0.0-1.0.
Returns an {r, g, b, 255} tuple.
Create an RGB color with full opacity.
Create an RGBA color.
Convert to ANSI 24-bit background escape sequence.
Convert to ANSI 24-bit foreground escape sequence.
Apply opacity (0.0-1.0) to a color by scaling its alpha.