greyscale property

ColorFilter greyscale
getter/setter pair

Creates a greyscale color with the same perceived luminance as the source color (as given by the L* value of the color in the CieLAB color space).

Implementation

static ColorFilter greyscale = ColorFilter((Color inputColor, [List<num> args = const []]) {
  var color = inputColor.toCielabColor();
  num rgbLevel = color.l * 255 / 100;
  return RgbColor(rgbLevel, rgbLevel, rgbLevel).toCielabColor();
}, CielabColor);