getQuantizedColor method

  1. @override
Color getQuantizedColor(
  1. Color c
)

Find the color closest to c in the colorMap.

Implementation

@override
Color getQuantizedColor(Color c) {
  final i = getColorIndex(c);
  final out = c.length == 4 ? ColorRgba8(0, 0, 0, 255) : ColorRgb8(0, 0, 0)
    ..r = palette.get(i, 0)
    ..g = palette.get(i, 1)
    ..b = palette.get(i, 2);
  if (c.length == 4) {
    out.a = c.a;
  }
  return out;
}