isBlackOrVariant method

bool isBlackOrVariant({
  1. int threshold = 30,
})

Implementation

bool isBlackOrVariant({int threshold = 30}) {
  // Extract the RGB values from the color
  var red = this.red;
  var green = this.green;
  var blue = this.blue;

  // Check if the RGB values are close to zero within a given threshold
  var isCloseToBlack =
      red < threshold && green < threshold && blue < threshold;

  return isCloseToBlack;
}