isDarkHsp function

bool? isDarkHsp(
  1. Color? color
)

Function to determine if a color is dark tone. It's based on HSP Color Model color: Argument to determine its status

Implementation

bool? isDarkHsp(Color? color) {
  if (color == null) return null;
  int _redValue = color.red;
  int _greenValue = color.green;
  int _blueValue = color.blue;
  double _hsp = sqrt(rConstant * pow(_redValue, 2) +
      gConstant * pow(_greenValue, 2) +
      bConstant * pow(_blueValue, 2));
  return _hsp < hspBoundary;
}