public static function decToHex($rgbArr, $withHash=true, $preferThreeChars=true)
	{
		if (!static::validateRgbColor($rgbArr)) return false;

		//get parts
		$hex = '';
		foreach ($rgbArr as $color) {
			$hex .= str_pad(dechex($color), 2, 0, STR_PAD_LEFT);
		}

		//three chars if desired and possible
		if ($preferThreeChars && $hex[0] == $hex[1] && $hex[2] == $hex[3] && $hex[4] == $hex[5]) {
			$hex = $hex[0] . $hex[2] . $hex[4];
		}

		return ($withHash ? '#' : '') . $hex;
	}