etui/color
Values
pub fn gradient(
stops: List(style.Color),
pos: Int,
max: Int,
) -> style.Color
Color at integer position pos within [0, max] across a list of
color stops. Stops are distributed evenly. Lerps between adjacent
stops. Requires Rgb stops for smooth blending; non-Rgb stops snap.
pub fn hue_to_rgb(hue: Int) -> style.Color
Convert a hue angle (0–359) to a fully-saturated Rgb color. Implements the HSV→RGB formula with S=1, V=1, integer arithmetic.
pub fn lerp_rgb(
a: style.Color,
b: style.Color,
t: Int,
max: Int,
) -> style.Color
Linear interpolation between two Rgb colors. For non-Rgb inputs, returns whichever endpoint is closer to t.
pub fn pulse(
c: style.Color,
frame: Int,
period: Int,
) -> style.Color
Oscillate an Rgb color between half and full brightness.
Use frame + x * phase_step for a per-cell wave effect.
Non-Rgb colors are returned unchanged.
pub fn rainbow(frame: Int, period: Int) -> style.Color
Returns an Rgb color that cycles through the full hue spectrum with the given period in frames.
pub fn scale(c: style.Color, factor: Int) -> style.Color
Scale all RGB channels by factor / 255.
factor=255 → unchanged, factor=128 → half brightness.