ColorPalette.splitComplimentary constructor

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

Generates a ColorPalette by selecting colors to both sides of the color with the opposite hue of color.

If numberOfColors is even, the coolor opposite of color will be included in the palette. If odd, the opposite color will be excluded from the palette. numberOfColors defaults to 3, must be > 0, and must not be null.

distance is the base spacing between the selected colors' hue values. distance defaults to 30 degrees 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.splitComplimentary(
  Color seed, {
  int numberOfColors = 3,
  num distance = 30,
  num hueVariability = 0,
  num saturationVariability = 0,
  num brightnessVariability = 0,
  bool perceivedBrightness = 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.splitComplimentary(
      RgbColor.fromColor(seed),
      numberOfColors: numberOfColors,
      distance: distance,
      hueVariability: hueVariability,
      saturationVariability: saturationVariability,
      brightnessVariability: brightnessVariability,
      perceivedBrightness: perceivedBrightness,
    ),
    growable: growable,
    unique: unique,
  ));
}