complementary method
The number of Color
s returned in this List
will match count
, and
the original color this
will be first amongst them.
Implementation
List<Color> complementary(int count, [double? distance]) {
double wrap(double component, double d) {
final sum = component + d;
if (sum >= 0 && sum <= 360) return sum;
return sum.remainder(360);
}
final shift = 360 / count;
final hsl = HSLColor.fromColor(this);
return List<Color>.generate(
count,
(int i) => HSLColor.fromAHSL(
hsl.alpha,
wrap(hsl.hue, shift * i),
hsl.saturation,
hsl.lightness,
).toColor());
}