gradient static method

List<Color> gradient(
  1. Color start,
  2. Color end, {
  3. int numberOfColors = 5,
  4. InterpolationMethod method = InterpolationMethod.oklab,
  5. bool shortestPath = true,
})

Implementation

static List<Color> gradient(Color start, Color end, {int numberOfColors = 5, InterpolationMethod method = InterpolationMethod.oklab, bool shortestPath = true}) {
  final colors = <Color>[];

  for (int i = 0; i < numberOfColors; i++) {
    final fraction = i / (numberOfColors - 1);
    final lerped = interpolate(start, end, fraction, method: method, shortestPath: shortestPath);
    colors.add(lerped);
  }

  return colors;
}