ColorPalette.polyad constructor

ColorPalette.polyad(
  1. Color seed, {
  2. int numberOfColors = 5,
  3. num hueVariability = 0,
  4. num saturationVariability = 0,
  5. num brightnessVariability = 0,
  6. bool perceivedBrightness = true,
  7. bool clockwise = true,
  8. bool growable = true,
  9. bool unique = false,
})

Generates a ColorPalette by selecting colors with hues evenly spaced around the color wheel from color.

numberOfColors defaults to 5, must be > 0 and must not be null.

hueVariability, saturationVariability, and brightnessVariability, if > 0, add a degree of randomness to the selected color's hue, saturation, and brightness (HSB's value) values, respectively.

hueVariability defaults to 0, must be >= 0 && <= 360, and must not be null.

saturationVariability and brightnessVariability both default to 0, must be >= 0 && <= 100, and must not be null.

Implementation

factory ColorPalette.polyad(
  Color seed, {
  int numberOfColors = 5,
  num hueVariability = 0,
  num saturationVariability = 0,
  num brightnessVariability = 0,
  bool perceivedBrightness = true,
  bool clockwise = true,
  bool growable = true,
  bool unique = false,
}) {
  assert(numberOfColors > 0);
  assert(hueVariability >= 0 && hueVariability <= 360);
  assert(saturationVariability >= 0 && saturationVariability <= 100);
  assert(brightnessVariability >= 0 && brightnessVariability <= 100);
  return ColorPalette(_cast(
    cp.ColorPalette.polyad(
      RgbColor.fromColor(seed),
      numberOfColors: numberOfColors,
      hueVariability: hueVariability,
      saturationVariability: saturationVariability,
      brightnessVariability: brightnessVariability,
      perceivedBrightness: perceivedBrightness,
      clockwise: clockwise,
    ),
    growable: growable,
    unique: unique,
  ));
}