private function _addColor($rgb) {
		if (!isset($this->_colors[$rgb])) {
			if (count($this->_colors) < 57) {
				// then we add a custom color altering the palette
				$colorIndex = 8 + count($this->_colors);
				$this->_palette[$colorIndex] =
					array(
						hexdec(substr($rgb, 0, 2)),
						hexdec(substr($rgb, 2, 2)),
						hexdec(substr($rgb, 4)),
						0
					);
				$this->_colors[$rgb] = $colorIndex;
			} else {
				// no room for more custom colors, just map to black
				$colorIndex = 0;
			}
		} else {
			// fetch already added custom color
			$colorIndex = $this->_colors[$rgb];
		}

		return $colorIndex;
	}
private function _addColor($rgb) {
		if (!isset($this->_colors[$rgb])) {
			if (count($this->_colors) < 57) {
				// then we add a custom color altering the palette
				$colorIndex = 8 + count($this->_colors);
				$this->_palette[$colorIndex] =
					array(
						hexdec(substr($rgb, 0, 2)),
						hexdec(substr($rgb, 2, 2)),
						hexdec(substr($rgb, 4)),
						0
					);
				$this->_colors[$rgb] = $colorIndex;
			} else {
				// no room for more custom colors, just map to black
				$colorIndex = 0;
			}
		} else {
			// fetch already added custom color
			$colorIndex = $this->_colors[$rgb];
		}

		return $colorIndex;
	}
private function _addColor ( $ rgb ) { if ( ! isset ( $ this -> _colors [ $ rgb ] ) ) { if ( count ( $ this -> _colors ) < 57 ) { // then we add a custom color altering the palette $ colorIndex = 8 + count ( $ this -> _colors ) ; $ this -> _palette [ $ colorIndex ] = array ( hexdec ( substr ( $ rgb , 0 , 2 ) ) , hexdec ( substr ( $ rgb , 2 , 2 ) ) , hexdec ( substr ( $ rgb , 4 ) ) , 0 ) ; $ this -> _colors [ $ rgb ] = $ colorIndex ; } else { // no room for more custom colors, just map to black $ colorIndex = 0 ; } } else { // fetch already added custom color $ colorIndex = $ this -> _colors [ $ rgb ] ; } return $ colorIndex ; }
Alter color palette adding a custom color

@param string $rgb E.g. 'FF00AA'
@return int Color index
Alter color palette adding a custom color