Returns an array with all the hexadecimal colors used in an image
@param int $limit
@param boolean $round
@return array
543606
public function getHexColors($limit = null, $round = true) {

		if(null !== $limit && false === ('-' . intval($limit) == '-' . $limit)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type integer, "%s" given', __METHOD__, gettype($limit)), E_USER_ERROR);
		}

		if(null !== $round && false === is_bool($round)) {
			return trigger_error(sprintf('Argument 2 passed to %s() must be of the type boolean, "%s" given', __METHOD__, gettype($round)), E_USER_ERROR);
		}

		return $this -> call() -> getHexColors($limit, $round);
	}
532401
public static function Color2Hex( $colorDefinition )
   {

      if ( \is_array( $colorDefinition ) )
      {
         if ( \count( $colorDefinition ) != 3 )
         {
            throw new ArgumentError(
               'colorDefinition',
               $colorDefinition,
               'Drawing',
               'A rgb array with 3 Elements is required!'
            );
         }
         return static::Rgb2Hex( $colorDefinition );
      }

      if ( static::IsHexFormat( $colorDefinition ) )
      {
         return $colorDefinition;
      }

      $uc = \strtolower( $colorDefinition );

      if ( isset( static::$ColornameHex[ $uc ] ) )
      {
         return \strtolower( static::$ColornameHex[ $uc ] );
      }

      if ( false !== ( $hex = static::Rgb2Hex( $colorDefinition ) ) )
      {
         return $hex;
      }

      return false;

   }
623734
private function _get_hue( $hex ) {
		$red   = hexdec( substr( $hex, 0, 2 ) );
		$green = hexdec( substr( $hex, 2, 2 ) );
		$blue  = hexdec( substr( $hex, 4, 2 ) );
		$max_rgb = max( $red, $green, $blue );
		$min_rgb = min( $red, $green, $blue );

		if ( $red === $green && $red === $blue ) {
			return 0;
		}

		$diff_max_min_rgb = $max_rgb - $min_rgb;

		if ( $red === $max_rgb ) {
			$hue = 60 * ( $diff_max_min_rgb ? ( $green - $blue ) / $diff_max_min_rgb : 0 );
		} elseif ( $green === $max_rgb ) {
			$hue = 60 * ( $diff_max_min_rgb ? ( $blue - $red ) / $diff_max_min_rgb : 0 ) + 120;
		} elseif ( $blue === $max_rgb ) {
			$hue = 60 * ( $diff_max_min_rgb ? ( $red - $green ) / $diff_max_min_rgb : 0 ) + 240;
		}

		if ( 0 > $hue ) {
			$hue += 360;
		}

		return $hue;
	}
245014
public static function ToDecArray ($rgb) {
		return (($hex_array = static::ToHexStringArray($rgb)) !== false) ? [hexdec($hex_array[0]), hexdec($hex_array[1]), hexdec($hex_array[2])] : false;
	}
881371
public static function explodeColor($hexColor, int $dr = null, int $dg = null, int $db = null): array
    {
        $colors = [];
        preg_match_all('/^#?([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})$/', trim($hexColor), $colors);
        if (isset($colors[1][0]) && isset($colors[2][0]) && isset($colors[3][0])) {
            return [hexdec($colors[1][0]), hexdec($colors[2][0]), hexdec($colors[3][0])];
        }
        return [$dr, $dg, $db];
    }
658150
private function _hexToIntArray($hex)
	{
		$array = array();

		$j = (int) strlen($hex) / 2;

		for ($i = 0; $i < $j; $i++)
		{
			$array[$i] = (int) $this->_hexToInt($hex, $i);
		}

		return $array;
	}
479219
public static function limit($limit) {
        //1. limit(10);
        if ( is_numeric($limit) ) {
            return array(0, $limit);

            //2. limit("10, 50")
        } else if ( is_string( $limit ) ) {
            return explode(',', $limit);
        }
        return $limit;
    }
185598
private function getRandColor()
    {
        $red = mt_rand(1,254);
        $green = mt_rand(1,254);

        if($red + $green > 400){
            $blue = 0;
        }else{
            $blue = 400 -$green - $red;
        }
        return [$red,$green,$blue];
    }
262958
private static function parseHexColor($input, &$result) 
    {
        if ($input[0] === '#') {
            $input = substr($input, 1);
        }

        // intval does not support unsigned 32-bit integers
        // so we need to parse large numbers stepwise
        $numeric24bit = intval(substr($input, 0, 6), 16);
        $alpha8bit = intval(substr($input, 6, 2), 16);

        switch (strlen($input)) {
            case 3:
                $result = self::fromRgb(
                    (($numeric24bit & 0xf00) >> 8) |
                    (($numeric24bit & 0xf00) >> 4),
                    (($numeric24bit & 0x0f0) >> 4) |
                    (($numeric24bit & 0x0f0)),
                    (($numeric24bit & 0x00f) << 4) |
                    (($numeric24bit & 0x00f))
                    );
                return true;
                
            case 4:
                $result = self::fromRgb(
                    (($numeric24bit & 0xf000) >> 12) |
                    (($numeric24bit & 0xf000) >> 8),
                    (($numeric24bit & 0x0f00) >> 8) |
                    (($numeric24bit & 0x0f00) >> 4),
                    (($numeric24bit & 0x00f0) >> 4) |
                    (($numeric24bit & 0x00f0)),
                    (($numeric24bit & 0x000f) << 4) |
                    (($numeric24bit & 0x000f))
                    );
                return true;
                
            case 6:
                $result = self::fromRgb(
                    0xff & ($numeric24bit >> 16),
                    0xff & ($numeric24bit >> 8),
                    0xff & ($numeric24bit)
                    );
                return true;
                
            case 8:
                $result = self::fromRgb(
                    0xff & ($numeric24bit >> 16),
                    0xff & ($numeric24bit >> 8),
                    0xff & ($numeric24bit),
                    0xff & ($alpha8bit)
                    );
                return true;
        }
        
        return false;
    }
117331
public function getLinks(int $limit = 0): array
    {
        if ($this->links === null) {
            $links = $this->attrs['links'] ?? [];
            $this->links = $this->removeInvalidOrHiddenLinks($links);
        }

        return $limit > 0 ? array_slice($this->links, 0, $limit) : $this->links;
    }
1230755
public function getRecentTrades($symbol = 'BNBBTC', $limit = 500)
    {
        $data = [
            'symbol' => $symbol,
            'limit'  => $limit,
        ];

        $b = $this->privateRequest('v3/myTrades', $data);
        return $b;

    }
922873
public function getResult($limit = 0, $offset = 0)
    {
        if ($limit > 0 && false === $this->limitOffset($limit, $offset)) {
            return [];
        }

        $stmt = $this->queryBuilder->execute();
        $this->result = $stmt->fetchAll();

        return $this->result;
    }
1358373
private function format($result, $count, $offset, $limit)
    {
        $nodes = [];
        foreach ($result as $item) {
            $resource = $this->getResource($item);
            $data = $this->getResourceData($resource);
            if ($data) {
                $nodes[] = $data;
            }
        }
        return [
            'total'  => $count,
            'offset' => $offset,
            'limit'  => $limit,
            'nodes'  => $nodes
        ];
    }
5794
function _hexToDecColor($hex)
    {
        $length = strlen($hex);
        $color['red'] = hexdec(substr($hex, $length - 6, 2));
        $color['green'] = hexdec(substr($hex, $length - 4, 2));
        $color['blue'] = hexdec(substr($hex, $length - 2, 2));
        return $color;
    }
718490
public function amount($decimal, $currency_code = null, $round = true)
    {
        static $factors = array();

        if (empty($currency_code)) {
            $currency_code = $this->currency->getDefault();
        }

        if (empty($factors[$currency_code])) {
            $currency = $this->currency->get($currency_code);
            $factors[$currency_code] = pow(10, $currency['decimals']);
        }

        if ($round) {
            $currency = $this->currency->get($currency_code);
            $decimal = $this->round($decimal, $currency);
            return (int) round($decimal * $factors[$currency_code]);
        }

        return $decimal * $factors[$currency_code];
    }
615091
protected function hexToRgb($hex)
    {
        if (! isset($this->colorCache[$hex])) {
            $this->colorCache[$hex] = [
                'r' => hexdec(substr($hex, 0, 2)),
                'g' => hexdec(substr($hex, 2, 2)),
                'b' => hexdec(substr($hex, 4, 2))
            ];
        }

        return $this->colorCache[$hex];
    }
886328
private function paletteToHex($palette): array
    {
        $r = [];
        foreach ($palette as $paletteColor) {
            $r[] = self::rgb2hex($paletteColor);
        }

        return $r;
    }