PaletteGenerator.fromColors constructor

PaletteGenerator.fromColors(
  1. List<PaletteColor> paletteColors, {
  2. List<PaletteTarget> targets = const <PaletteTarget>[],
})

Create a PaletteGenerator from a set of paletteColors and targets.

The usual way to create a PaletteGenerator is to use the asynchronous PaletteGenerator.fromImage static function. This constructor is mainly used for cases when you have your own source of color information and would like to use the target selection and scoring methods here.

Implementation

PaletteGenerator.fromColors(
  this.paletteColors, {
  this.targets = const <PaletteTarget>[],
}) : selectedSwatches = <PaletteTarget, PaletteColor>{} {
  _sortSwatches();
  _selectSwatches();
}