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 = new ColorFilter((Color inputColor, [List? args]) {
  CielabColor color = inputColor.toCielabColor();
  num percent = 0.1;
  if (args is List && args.length > 0 && args[0] is num) {
    percent = args[0];
  }
  return new CielabColor(color.l * (1 + percent), color.a, color.b);
}, CielabColor);