colorClose function

bool colorClose(
  1. List<int> actual,
  2. List<int> expected, {
  3. int tolerance = 2,
})

Whether every channel of actual is within tolerance of expected.

Implementation

bool colorClose(List<int> actual, List<int> expected, {int tolerance = 2}) {
  if (actual.length != expected.length) return false;
  for (var i = 0; i < actual.length; i++) {
    if ((actual[i] - expected[i]).abs() > tolerance) return false;
  }
  return true;
}