Function zng_color::rgba

source ·
pub fn rgba<C: Into<RgbaComponent>, A: Into<RgbaComponent>>(
    red: C,
    green: C,
    blue: C,
    alpha: A
) -> Rgba
Expand description

RGBA color.

§Arguments

The arguments can either be f32 in the 0.0..=1.0 range or u8 in the 0..=255 range or a percentage.

The rgb arguments must be of the same type, the alpha argument can be of a different type.

§Examples

use zng_color::rgba;

let half_red = rgba(255, 0, 0, 0.5);
let green = rgba(0.0, 1.0, 0.0, 1.0);
let transparent = rgba(0, 0, 0, 0);