Given a Color object, returns a formatted hsla string

@param  object $color Color object
@return string
766928
public function getHslaString(Color $color)
    {
        return 'hsla('. round($color->hue) . ', ' . round($color->saturation * 100) . '%, ' . round($color->lightness * 100) . '%, ' . $color->alpha . ')';
    }
352785
public function getRgbaHexString(Color $color)
    {
        $alpha = dechex(255 * $color->alpha);
        return '#' . $color->hex . $alpha;
    }
891196
function ( color ) {
            var hsla = {};
            color.replace( this.REG_HSL, function ( str, h, s, l, a ) {
                hsla = {h: parseFloat(h), s: parseFloat(s), l: parseFloat(l), a: 1};
                if ( a ) hsla.a = Number(a);
            });
            return hsla;
        }
799434
public static function rgba(Color $color, $alpha = 1.0)
    {
        return sprintf(
            'rgba(%d, %d, %d, %s)',
            $color->getRgb()['r'],
            $color->getRgb()['g'],
            $color->getRgb()['b'],
            $alpha + 0
        );
    }
1074940
public static function foreground($color)
    {
        list($red, $green, $blue) = str_split(substr($color, 1), 2);

        $red   = hexdec($red);
        $green = hexdec($green);
        $blue  = hexdec($blue);

        return ($red < 200 && $green < 100 && $blue < 200) ? self::WHITE : self::BLACK;
    }
547853
public static function colorize($string, $color)
    {
        if (isset(self::$colors[$color])) {
            return "\033[" . self::$colors[$color] . 'm' . $string . "\033[0m";
        }

        return $string;
    }
809690
public static function create( $color ) 
	{
		// our return
		$rgb = array();

		if ( is_array( $color ) ) 
		{
			$color = array_values( $color );
			$rgb[0] = $color[0];
			$rgb[1] = $color[1];
			$rgb[2] = $color[2];
		}
		// parse hex color 
		elseif ( is_string( $color ) && substr( $color, 0, 1 ) == '#' ) 
		{
			$color = substr( $color, 1 );

			if( strlen( $color ) == 3 ) 
			{
				$rgb[0] = hexdec( substr( $color, 0, 1 ) . substr( $color, 0, 1 ) );
				$rgb[1] = hexdec( substr( $color, 1, 1 ) . substr( $color, 1, 1 ) );
				$rgb[2] = hexdec( substr( $color, 2, 1 ) . substr( $color, 2, 1 ) );
			}
			elseif( strlen( $color ) == 6 ) 
			{
				$rgb[0] = hexdec( substr( $color, 0, 2 ) );
				$rgb[1] = hexdec( substr( $color, 2, 2 ) );
				$rgb[2] = hexdec( substr( $color, 4, 2 ) );
			}
		}
		// could not be parsed 
		else 
		{
			return false;
		}

		return new static( $rgb );
	}
1053933
static public function color($color) {
		if (!is_array($color)) {
			$color = compact('color');
		}

		$color += array('color' => null, 'style' => null, 'background' => null);

		if ($color['color'] == 'reset') {
			return "\033[0m";
		}

		$colors = array();
		foreach (array('color', 'style', 'background') as $type) {
			$code = $color[$type];
			if (isset(self::$_colors[$type][$code])) {
				$colors[] = self::$_colors[$type][$code];
			}
		}

		if (empty($colors)) {
			$colors[] = 0;
		}

		return "\033[" . join(';', $colors) . "m";
	}
891491
public static function transformRGB($color = '#000000') {
		if (strlen($color) == 4) {
			$red = substr($color, 1, 1);
			$green = substr($color, 2, 1);
			$blue = substr($color, 3, 1);
			$red .= $red;
			$green .= $green;
			$blue .= $blue;
		} else {
			$red = substr($color, 1, 2);
			$green = substr($color, 3, 2);
			$blue = substr($color, 5, 2);
		}
		return array(
				hexdec($red),
				hexdec($green),
				hexdec($blue)
		);
	}
997220
public static function parse($color)
    {
        $hsl = '/hsl\(([0-9]{1,3}),\s*([0-9]{1,3})%,\s*([0-9]{1,3})%\)/';
        $rgb = '/rgb\(([0-9]{1,3}),\s*([0-9]{1,3}),\s*([0-9]{1,3})\)/';

        // HSL
        if (preg_match($hsl, $color, $m)) {
            return static::hsl((int)$m[1], (int)$m[2] / 100, (int)$m[3] / 100);
        } // RGB
        elseif (preg_match($rgb, $color, $m)) {
            return static::rgb((int)$m[1], (int)$m[2], (int)$m[3]);
        } // Hex
        else {
            return static::hex($color);
        };

    }
480837
public function color($color)
    {
        if ($color instanceof Collection) {
            $color = $color->toArray();
        }

        return $this->options([
            'color' => $color,
        ]);
    }
1229350
public function getArgbHexString(Color $color)
    {
        $alpha = dechex(255 * $color->alpha);
        return '#' . $alpha . $color->hex;
    }
831387
public function setColor($color)
	{
		if ( ! $this->isValidColor($color))
		{
			throw new \InvalidArgumentException('Invalid color format.');
		}
		
		$this->color = (string) $color;
		
		return $this;
	}
458620
public function load(Color $color, $value)
    {
        $value = strtolower(trim($value));

        $format = $this->guess($value);

        if (is_callable(__CLASS__ . '::' . $format)) {
            $this->$format($color, $value);
        }

        return $color;
    }
985797
protected static function resolveColor($color, $mode = 'hex')
    {
        switch ($mode) {
            case 'hex':
                $red = sprintf('%02x', $color[0]);
                $green = sprintf('%02x', $color[1]);
                $blue = sprintf('%02x', $color[2]);
                $color = '#' . $red . $green . $blue;
                break;
            case 'rgb':
                $colorStr = self::hasAlpha($color) ? 'rgba(' : 'rgb(';

                $colorStr .= '' . $color[0] . ',' . $color[1] . ',' . $color[2];

                $colorStr .= self::hasAlpha($color) ? ',' . number_format($color[3], 2, '.', ',') . ')' : ')';
                $color = $colorStr;
                break;
            default:
                $color = '';
        }

        return $color;
    }
605306
protected function parse_color($color) {
        if (strpos($color, '#') === 0) {
            // No conversion should be needed.
            return $color;
        }

        if ($color > 7 and $color < 53) {
            $numbers = array(
                8  => 'black',
                12 => 'blue',
                16 => 'brown',
                15 => 'cyan',
                23 => 'gray',
                17 => 'green',
                11 => 'lime',
                14 => 'magenta',
                18 => 'navy',
                53 => 'orange',
                33 => 'pink',
                20 => 'purple',
                10 => 'red',
                22 => 'silver',
                9  => 'white',
                13 => 'yellow',
            );
            if (isset($numbers[$color])) {
                $color = $numbers[$color];
            } else {
                $color = 'black';
            }
        }

        $colors = array(
            'aqua'    => '00FFFF',
            'black'   => '000000',
            'blue'    => '0000FF',
            'brown'   => 'A52A2A',
            'cyan'    => '00FFFF',
            'fuchsia' => 'FF00FF',
            'gray'    => '808080',
            'grey'    => '808080',
            'green'   => '00FF00',
            'lime'    => '00FF00',
            'magenta' => 'FF00FF',
            'maroon'  => '800000',
            'navy'    => '000080',
            'orange'  => 'FFA500',
            'olive'   => '808000',
            'pink'    => 'FAAFBE',
            'purple'  => '800080',
            'red'     => 'FF0000',
            'silver'  => 'C0C0C0',
            'teal'    => '008080',
            'white'   => 'FFFFFF',
            'yellow'  => 'FFFF00',
        );

        if (isset($colors[$color])) {
            return('#'.$colors[$color]);
        }

        return('#'.$colors['black']);
    }
810391
public function complimentaryTheme($color)
    {
        $parsedColor = $this->parseColor($color);
        $yiq = $this->calculateYIQValue($parsedColor->toRGB());
        if ($yiq > 128) {
            return self::DARK;
        } else {
            return self::LIGHT;
        }
    }