zng::color

Function hsva

source
pub fn hsva<H, N, A>(hue: H, saturation: N, value: N, alpha: A) -> Hsva
where H: Into<AngleDegree>, N: Into<Factor>, A: Into<Factor>,
Expand description

HSVA color.

§Arguments

The first argument hue can be any angle unit. The other two arguments can be f32 in the 0.0..=1.0 range or a percentage.

The saturation and value arguments must be of the same type.

§Examples

use zng_color::hsva;
use zng_layout::unit::*;

let red = hsva(0.deg(), 100.pct(), 50.pct(), 1.0);
let green = hsva(115.deg(), 1.0, 0.5, 100.pct());
let transparent = hsva(0.deg(), 1.0, 0.5, 0.0);