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 = new ColorFilter((Color inputColor, [List? args]) {
  CielabColor color = inputColor.toCielabColor();
  num rgbLevel = color.l * 255 / 100;
  return new RgbColor(rgbLevel, rgbLevel, rgbLevel).toCielabColor();
}, CielabColor);