getOnSurfaceColor function
Returns a color that would be suitable to be drawn on a surface whose
color is the given surfaceColor
. If the surface color is dark, then
the returned color will be light, otherwise it will be dark.
By default, white color will be returned if the surface color is dark,
and black color will be returned if the surface color is light.
Implementation
Color getOnSurfaceColor(Color surfaceColor,
{Color colorIfDark = Colors.white, Color colorIfLight = Colors.black}) {
return isColorDark(surfaceColor) ? colorIfDark : colorIfLight;
}