getContrastColor method

Color getContrastColor([
  1. double percent = .8
])

Returns a contrast color based on the brightness of the first color: A light color if the first color is dark. A dark color if the first color is light.

TheColor: First color Percent: Degree of blending of the dark or light color

Returns a light color if the first color is dark, a dark color if the first color is light.

Implementation

Color getContrastColor([double percent = .8]) => luminance < 0.5 ? this.makeDarker(percent) : this.makeLighter(percent);