blend method
Blend in the given input Color with a percentage of alpha.
You typically apply this on a background color, light or dark to create a background color with a hint of a color used in a theme.
This is a use case of the alphaBlend static function that exists in dart:ui Color. It is used to create the branded surface colors in ZetaColorScheme and to calculate dark scheme colors from light ones, by blending in white color with light scheme color.
Defaults to 10% alpha blend of the passed in Color value.
Implementation
Color blend(Color input, [int amount = 10]) {
// Skip blending for impossible value and return the instance color value.
if (amount <= 0) return this;
// Blend amounts >= 100 results in the input Color.
if (amount >= 100) return input;
return Color.alphaBlend(input.withAlpha(255 * amount ~/ 100), this);
}