From 7cef15cfd89b5c2a1f1149043c87cb123488a68f Mon Sep 17 00:00:00 2001 From: Julian Raab Date: Wed, 8 Jul 2020 14:44:26 +0200 Subject: [PATCH] changing color pallet --- src/BrianMcdo/ImagePalette/ImagePalette.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/BrianMcdo/ImagePalette/ImagePalette.php b/src/BrianMcdo/ImagePalette/ImagePalette.php index 45b1a3d..dfc6c04 100644 --- a/src/BrianMcdo/ImagePalette/ImagePalette.php +++ b/src/BrianMcdo/ImagePalette/ImagePalette.php @@ -98,7 +98,7 @@ class ImagePalette implements IteratorAggregate * @param int $paletteLength * @param string $library */ - public function __construct($file, $precision = 10, $paletteLength = 5, $library = 'gd') + public function __construct($file, $precision = 10, $paletteLength = 5, $library = 'gd', $whiteList = array()) { $this->file = $file; $this->precision = $precision; @@ -107,6 +107,10 @@ public function __construct($file, $precision = 10, $paletteLength = 5, $library // use provided libname or auto-detect $this->lib = $this->graphicsLibrary($library); + if (!empty($whiteList)) { + $this->whiteList = $whiteList; + } + // create an array with color ints as keys $this->whiteList = array_fill_keys($this->whiteList, 0);