withBackground method

Color withBackground(
  1. Color background
)

Resolves against a background color.

If background is opaque, the returned color will also be opaque.

Implementation

Color withBackground(Color background) => alpha == 1
    ? this
    : Color.rgba(
        _lerpNum(background.red, red, alpha).toInt(),
        _lerpNum(background.green, green, alpha).toInt(),
        _lerpNum(background.blue, blue, alpha).toInt(),
        _lerpNum(background.alpha, 1, alpha));