INNER CODE UNIT · Rust
from_hsv
sharkdp/pastel · src/lib.rs:68
pub fn from_hsv(hue: Scalar, saturation: Scalar, value: Scalar) -> Color {
Self::from(&HSVA {
h: hue,
s: saturation,
v: value,
alpha: 1.0,
})
}
/// Create a `Color` from integer RGB values between 0 and 255 and a floating
/// point alpha value between 0.0 and 1.0.
pub fn from_rgba(r: u8, g: u8, b: u8, alpha: Scalar) -> Color {
// RGB to HSL conversion algorithm adapted from
// https://en.wikipedia.org/wiki/HSL_and_HSV
Self::from(&RGBA::<u8> { r, g, b, alpha })
}
/// Create a `Color` from integer RGB values between 0 and 255.