pub fn average(colors: &[RGB]) -> RGB {
        let (mut rtot, mut gtot, mut btot): (f32, f32, f32) = (0.0, 0.0, 0.0);

        for px in colors.iter() {
            rtot += px.r;
            gtot += px.g;
            btot += px.b;
        }

        let nf = colors.len() as f32;
        RGB::new(rtot / nf, gtot / nf, btot / nf)
    }
/** Average a slice of color values. */
Average a slice of color values.
Average a slice of color values .
pub fn average(colors: &[RGB]) -> RGB {
        let (mut rtot, mut gtot, mut btot): (f32, f32, f32) = (0.0, 0.0, 0.0);
        for px in colors.iter() {
            rtot += px.r;
            gtot += px.g;
            btot += px.b;
        }
        let nf = colors.len() as f32;
        RGB::new(rtot / nf, gtot / nf, btot / nf)
    }
pub fn average ( colors : & [ RGB ] ) -> RGB { let ( mut rtot , mut gtot , mut btot ) : ( f32 , f32 , f32 ) = ( 0.0 , 0.0 , 0.0 ) ; for px in colors . iter ( ) { rtot += px . r ; gtot += px . g ; btot += px . b ; } let nf = colors . len ( ) as f32 ; RGB :: new ( rtot / nf , gtot / nf , btot / nf ) }
Average a slice of color values.
Average a slice of color values .
colors
&[RGB]
colors
&[RGB]