pub fn quantize(c: Rgb, palette: &[Rgb]) -> usizeExpand description
Index of the entry in palette that looks most like c.
OKLab distance rather than distance in sRGB, for the same reason mix
interpolates there: sRGB’s numbers are not spaced the way seeing is, so a
nearest match computed in it picks visibly wrong entries in the mid tones.
§Panics
If palette is empty.