fromList static method

TonalPalette fromList(
  1. List<int> colors
)

Create colors from a fixed-size list of ARGB color ints.

Inverse of TonalPalette.asList.

Implementation

static TonalPalette fromList(List<int> colors) {
  assert(colors.length == commonSize, 'Length of list must be $commonSize');
  final Map<int, int> cache = <int, int>{};
  commonTones.asMap().forEach(
      (int index, int toneValue) => cache[toneValue] = colors[index]);
  return TonalPalette._fromCache(cache);
}