getOnSurfaceColor function

Color getOnSurfaceColor(
  1. Color surfaceColor, {
  2. Color colorIfDark = Colors.white,
  3. Color colorIfLight = Colors.black,
})

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;
}