colorList method

List<Color> colorList(
  1. Color color, {
  2. required Swell swell,
  3. required int depth,
})

Provide a required color from which this Curvature may generate a corresponding List<Color>. The depth of the effect is a required int. A lower depth fades the object more into its background, while a larger one will set the object more apart by contrast.

Implementation

List<Color> colorList(
  Color color, {
  required Swell swell,
  required int depth,
}) {
  final _color = swell.toColor(color, depth);

  switch (this) {
    case Curvature.superconcave:
      return [
        _color.withBlack((depth * 1.5).round()),
        _color,
        _color.withWhite((depth * 1.5).round()),
      ];
    case Curvature.concave:
      return [
        _color.withBlack(depth),
        _color,
        _color.withWhite(depth),
      ];
    case Curvature.flat:
      return [_color, _color, _color];
    case Curvature.convex:
      return [
        _color.withWhite(depth),
        _color,
        _color.withBlack(depth),
      ];
    case Curvature.superconvex:
      return [
        _color.withWhite((depth * 1.5).round()),
        _color,
        _color.withBlack((depth * 1.5).round()),
      ];
  }
}