mirror of
https://github.com/janishutz/color-thief.git
synced 2025-11-25 13:54:25 +00:00
Merge pull request #57 from mhahmadi/mhahmadi_fix_getpalette_validation
fixes #56
This commit is contained in:
@@ -98,7 +98,7 @@ ColorThief.prototype.getColor = function(sourceImage, quality) {
|
|||||||
*/
|
*/
|
||||||
ColorThief.prototype.getPalette = function(sourceImage, colorCount, quality) {
|
ColorThief.prototype.getPalette = function(sourceImage, colorCount, quality) {
|
||||||
|
|
||||||
if (typeof colorCount === 'undefined') {
|
if (typeof colorCount === 'undefined' || colorCount < 2 || colorCount > 256) {
|
||||||
colorCount = 10;
|
colorCount = 10;
|
||||||
}
|
}
|
||||||
if (typeof quality === 'undefined' || quality < 1) {
|
if (typeof quality === 'undefined' || quality < 1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user