colorExtension extension
Extension methods to help dealing with colors.
- on
Methods
-
basedOnLuminance(
{Color darkColor = Colors.black, Color lightColor = Colors.white}) → Color -
Get a constrast color based on the luminance of this color. If
the luminance is bigger than 0.5,
darkColor
is used, otherwiselightColor
is used. -
lerpWith(
Color color, double t) → Color - Lerp this color with another color.
-
resolve(
BuildContext context) → Color -
toAccentColor(
{double darkestFactor = 0.38, double darkerFactor = 0.30, double darkFactor = 0.15, double lightFactor = 0.15, double lighterFactor = 0.30, double lightestFactor = 0.38}) → AccentColor - Creates a new accent color based on this color. This provides the shades by lerping this color with Colors.black if dark or darker, and with Colors.white if light or lighter.