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

        let max_chroma = u8::max(u8::max(r, g), b);
        let min_chroma = u8::min(u8::min(r, g), b);

        let chroma = max_chroma - min_chroma;
        let chroma_s = Scalar::from(chroma) / 255.0;

        let r_s = Scalar::from(r) / 255.0;
        let g_s = Scalar::from(g) / 255.0;
        let b_s = Scalar::from(b) / 255.0;

        let hue = 60.0
            * (if chroma == 0 {
                0.0
            } else if r == max_chroma {
                mod_positive((g_s - b_s) / chroma_s, 6.0)
            } else if g == max_chroma {
                (b_s - r_s) / chroma_s + 2.0
            } else {
                (r_s - g_s) / chroma_s + 4.0
            });

        let lightness = (Scalar::from(max_chroma) + Scalar::from(min_chroma)) / (255.0 * 2.0);
        let saturation = if chroma == 0 {
            0.0
        } else {
            chroma_s / (1.0 - Scalar::abs(2.0 * lightness - 1.0))
        };

        Self::from_hsla(hue, saturation, lightness, alpha)
    }
/// Create a `Color` from integer RGB values between 0 and 255 and a floating
/// point alpha value between 0.0 and 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.
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
        let max_chroma = u8::max(u8::max(r, g), b);
        let min_chroma = u8::min(u8::min(r, g), b);
        let chroma = max_chroma - min_chroma;
        let chroma_s = Scalar::from(chroma) / 255.0;
        let r_s = Scalar::from(r) / 255.0;
        let g_s = Scalar::from(g) / 255.0;
        let b_s = Scalar::from(b) / 255.0;
        let hue = 60.0
            * (if chroma == 0 {
                0.0
            } else if r == max_chroma {
                mod_positive((g_s - b_s) / chroma_s, 6.0)
            } else if g == max_chroma {
                (b_s - r_s) / chroma_s + 2.0
            } else {
                (r_s - g_s) / chroma_s + 4.0
            });
        let lightness = (Scalar::from(max_chroma) + Scalar::from(min_chroma)) / (255.0 * 2.0);
        let saturation = if chroma == 0 {
            0.0
        } else {
            chroma_s / (1.0 - Scalar::abs(2.0 * lightness - 1.0))
        };
        Self::from_hsla(hue, saturation, lightness, alpha)
    }
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 let max_chroma = u8 :: max ( u8 :: max ( r , g ) , b ) ; let min_chroma = u8 :: min ( u8 :: min ( r , g ) , b ) ; let chroma = max_chroma - min_chroma ; let chroma_s = Scalar :: from ( chroma ) / 255.0 ; let r_s = Scalar :: from ( r ) / 255.0 ; let g_s = Scalar :: from ( g ) / 255.0 ; let b_s = Scalar :: from ( b ) / 255.0 ; let hue = 60.0 * ( if chroma == 0 { 0.0 } else if r == max_chroma { mod_positive ( ( g_s - b_s ) / chroma_s , 6.0 ) } else if g == max_chroma { ( b_s - r_s ) / chroma_s + 2.0 } else { ( r_s - g_s ) / chroma_s + 4.0 } ) ; let lightness = ( Scalar :: from ( max_chroma ) + Scalar :: from ( min_chroma ) ) / ( 255.0 * 2.0 ) ; let saturation = if chroma == 0 { 0.0 } else { chroma_s / ( 1.0 - Scalar :: abs ( 2.0 * lightness - 1.0 ) ) } ; Self :: from_hsla ( hue , saturation , lightness , alpha ) }
Create a `Color` from integer RGB values between 0 and 255 and a floating
point alpha value between 0.0 and 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 .
r
u8
g
u8
b
u8
alpha
Scalar
r
u8
g
u8
b
u8
alpha
Scalar