operator - method

dynamic operator -(
  1. dynamic other
)

Implementation

operator -(other) {
  double red = 0;
  double green = 0;
  double blue = 0;
  double alpha = 0;

  if (other is num) {
    red = (r - other).clamp(0, 255);
    green = (g - other).clamp(0, 255);
    blue = (b - other).clamp(0, 255);
    alpha = (a - other).clamp(0, 255);
  } else {
    var c = flatString(other).asColor;
    red = (r - c.r).clamp(0, 255);
    green = (g - c.g).clamp(0, 255);
    blue = (b - c.b).clamp(0, 255);
    alpha = (a - c.a).clamp(0, 255);
  }

  return Color.from(alpha: alpha, red: red, green: green, blue: blue);
}