0

I understand that the Palette's

Palette.from(bitmap).generate();

method picks by default 16 colors and then finds the best fit for the 6 main color swatches (vibrant, dark vibrant etc.)

I can increase the number of generated colors with

Palette.from(bitmap).maximumColorCount(number).generate();

and it has a higher chance of finding a good color for the different swatches.

But there is no explanation about how these 16+ colors are picked? On what criteria? Why do I get 6 different "main" swatches when I generate different amount of colors, why doesn't it just search for the best fit from the image directly?

Florian Walther
  • 6,237
  • 5
  • 46
  • 104
  • Based on a lot of criteria from color theory and design. There's no requirement for you to use this library- if you don't like the colors it picks, either pick your own colors manually or write your own auto generator. You may be able to find the current criteria in the source code (or not), but expect them to change over time. – Gabe Sechan Feb 27 '18 at 21:47
  • I like the colors, I just want to understand it better. I looked into the source code and find comments about "quantization". I looked that word up in wikipedia and it seems that this is just compressing an image down to its most prominent colors. Like when you make a comic out of a photo. So I guess the Palette class picks the most PROMINENT colors of an image. – Florian Walther Feb 27 '18 at 21:49
  • As for why it doesn't just pick 1 swatch instead of 6- they provide different sets for different looks- bright colors, muted colors, vibrant colors, etc. Presumably they figured you'd know what you want. – Gabe Sechan Feb 27 '18 at 21:49

0 Answers0