populationOf method

int? populationOf(
  1. Color color
)

Population (pixel count) for a specific color, or null if the color is not part of the palette.

Implementation

int? populationOf(Color color) {
  for (final s in swatches) {
    if (s.color == color) return s.population;
  }
  return null;
}