[][src]Function termimage::util::closest_colour

pub fn closest_colour<P: Index<usize, Output = u8>>(
    to: Rgb<u8>,
    out_of: &[P]
) -> usize

Get the closest colour to the provided one out of the specified list of colours and retirn its index.

The formula was taken from this SO answer and might not be the best, but we only ever have a VERY limited colourset, so it shouldn't really matter that much.