Function lux::color::rgba [] [src]

pub fn rgba<T: ToColorComponent>(r: T, g: T, b: T, a: T) -> [f32; 4]

Constructs a color from R, G, B, and A components.

If the numbers are u8s the scale is from 0 to 255. If the numbers are floating point, the scale is from 0.0 to 1.0.

 // With f32 or f64
 let transparent_red = rgba(1.0, 0.0, 0.0, 0.5);
 // With integers
 let transparent_green = rgba(0, 255, 0, 125);