lightenRgb function

List<num> lightenRgb (
  1. num amount,
  2. List<num> rgb
)

returns a lightened rgb array. amount is a value in the range [0, 1]

Implementation

List<num> lightenRgb(num amount, List<num> rgb) => rgb
    .map((c) => [
          [0, c + (c * amount)].reduce(math.max),
          255
        ].reduce(math.min).round())
    .toList();