analogous method

List<Color> analogous({
  1. int count = 3,
  2. double angle = 30,
})

Returns count analogous colors spaced angle degrees apart on the color wheel, centered on this color.

Colors.blue.analogous() // 3 colors around blue

Implementation

List<Color> analogous({int count = 3, double angle = 30}) {
  final hsl = HSLColor.fromColor(this);
  final half = (count ~/ 2);
  return List.generate(
    count,
    (i) => hsl.withHue((hsl.hue + angle * (i - half)) % 360).toColor(),
  );
}