findLight method

Color findLight()

Finds a lighter variant of the color.

Implementation

Color findLight() {
  final hsl = HSLColor.fromColor(this);
  var lightness = math.max(0.96, hsl.lightness);

  if (_isWhiteOrBlack) {
    final v = (lightness * 255).round().clamp(0, 255);
    return Color.fromARGB(alpha, v, v, v);
  }

  return hsl.withLightness(lightness.clamp(0.0, 1.0)).toColor();
}