lighten property

ColorFilter lighten
getter/setter pair

Makes the color lighter by the percentage specified in the first argument, or by 10% if no percentage is specified. Percentages should be specified as a float, e.g. an argument of 0.25 will result in a color 25% lighter than the original. The lightening conversion is performed by adjusting the y component of the color in XYZ color space.

Implementation

static ColorFilter lighten = ColorFilter((Color inputColor, [List<num> args = const []]) {
  var color = inputColor.toCielabColor();
  num percent = 0.1;
  if (args.isNotEmpty) {
    percent = args[0];
  }
  return CielabColor(color.l * (1 + percent), color.a, color.b);
}, CielabColor);