tranformToDarkColor static method

Color tranformToDarkColor(
  1. Color color
)

Implementation

static Color tranformToDarkColor(Color color) {
  // Convert to lab color
  LabColor lab = RgbColor(color.red, color.green, color.blue).toLabColor();
  num invertedL = min(110 - lab.l, 100);
  if (invertedL < lab.l) {
    RgbColor rgb = LabColor(invertedL, lab.a, lab.b).toRgbColor();
    return Color.fromARGB(color.alpha, rgb.r.toInt(), rgb.g.toInt(), rgb.b.toInt());
  } else {
    return color;
  }
}