decolorize method
Makes the current color more grey (aprox. keeping its luminance), by the given value
,
from 0
(no change) to 1
(grey).
If value
is not provided, it will be 1 (100% change, no color at all).
If value
is less than 0, it's 0. If more than 1, it's 1.
Doesn't change the opacity.
See also: ChangeColors
Implementation
Color decolorize([double value = 1]) {
int average = (red + green + blue) ~/ 3;
var color = Color.fromARGB(alpha, average, average, average);
return Color.lerp(this, color, _limit(value))!;
}