darken static method

MacosColor darken(
  1. MacosColor c, [
  2. int percent = 10
])

Darkens a MacosColor by a percent amount (100 = black) without changing the tint of the color.

Implementation

static MacosColor darken(MacosColor c, [int percent = 10]) {
  assert(1 <= percent && percent <= 100);
  var f = 1 - percent / 100;
  return MacosColor.fromARGB(
    c.alpha,
    (c.red * f).round(),
    (c.green * f).round(),
    (c.blue * f).round(),
  );
}