getShades method

List<Color> getShades(
  1. int stepCount, {
  2. bool skipFirst = true,
})

generate the gradient of a color with lightness from 0 to 1 in stepCount steps

Implementation

List<Color> getShades(int stepCount, {bool skipFirst = true}) =>
    List.generate(
      stepCount,
      (index) {
        return hsl
            .withLightness(1 -
                ((index + (skipFirst ? 1 : 0)) /
                    (stepCount - (skipFirst ? -1 : 1))))
            .toColor();
      },
    );