dx method

Color dx(
  1. double percentage
)

Implementation

Color dx(double percentage) {
  assert(percentage >= 0 && percentage <= 100);
  final x = (percentage / 100 * 255).round();
  final base = this ?? Colors.transparent;
  int r = base.red - x;
  int g = base.green - x;
  int b = base.blue - x;
  if (r < 0) r = 0;
  if (g < 0) g = 0;
  if (b < 0) b = 0;
  return Color.fromARGB(base.alpha, r, g, b);
}