Fixes issue #32

This commit is contained in:
nteike
2014-05-19 15:29:04 +02:00
parent d515f4c344
commit fb256832b8

View File

@@ -64,7 +64,7 @@ var ColorThief = function () {};
* Use the median cut algorithm provided by quantize.js to cluster similar
* colors and return the base color from the largest cluster.
*
* Quality is an optional argument. It needs to be an integer. 0 is the highest quality settings.
* Quality is an optional argument. It needs to be an integer. 1 is the highest quality settings.
* 10 is the default. There is a trade-off between quality and speed. The bigger the number, the
* faster a color will be returned but the greater the likelihood that it will not be the visually
* most dominant color.
@@ -88,7 +88,7 @@ ColorThief.prototype.getColor = function(sourceImage, quality) {
*
* BUGGY: Function does not always return the requested amount of colors. It can be +/- 2.
*
* quality is an optional argument. It needs to be an integer. 0 is the highest quality settings.
* quality is an optional argument. It needs to be an integer. 1 is the highest quality settings.
* 10 is the default. There is a trade-off between quality and speed. The bigger the number, the
* faster the palette generation but the greater the likelihood that colors will be missed.
*
@@ -99,7 +99,7 @@ ColorThief.prototype.getPalette = function(sourceImage, colorCount, quality) {
if (typeof colorCount === 'undefined') {
colorCount = 10;
}
if (typeof quality === 'undefined') {
if (typeof quality === 'undefined' || quality < 1) {
quality = 10;
}