generate static method

Iterable<Color24> generate({
  1. int sample = 1,
})

The 24-bit color palette.

Unlike Color4.values and Color8.values, this is a generator that yields up to all 16,777,216 colors in the 24-bit palette, as it is impractical to store them all in memory.

May optionally provide a sample value to limit the number of colors generated to every sample-th color for every component. For example, a sample value of 2 will generate every other color, resulting in 1/8th of the total colors.

Implementation

static Iterable<Color24> generate({int sample = 1}) sync* {
  RangeError.checkNotNegative(sample, 'sample');
  for (var r = 0; r < 256; r += sample) {
    for (var g = 0; g < 256; g += sample) {
      for (var b = 0; b < 256; b += sample) {
        yield Color24.fromRGB(r, g, b);
      }
    }
  }
}