deriveTrail function

List<Color> deriveTrail(
  1. Color bright, {
  2. int steps = 6,
})

Derives a gradient of trail colors from a single bright color.

Each step is progressively dimmed (via Color.dim) to create the falling trail effect behind the scanner head.

Implementation

List<Color> deriveTrail(Color bright, {int steps = 6}) {
  final result = <Color>[bright];
  var current = bright;
  for (var i = 1; i < steps; i++) {
    current = current.dim;
    result.add(current);
  }
  return result;
}