Automattic\WooCommerce\Vendor\Sabberworm\CSS\Value

Color::renderpublicWC 1.0

Method of the class: Color{}

No Hooks.

Returns

String.

Usage

$Color = new Color();
$Color->render( $oOutputFormat );
$oOutputFormat(OutputFormat|null) (required)
.

Color::render() code WC 10.5.0

public function render($oOutputFormat)
{
    // Shorthand RGB color values
    if ($oOutputFormat->getRGBHashNotation() && implode('', array_keys($this->aComponents)) === 'rgb') {
        $sResult = sprintf(
            '%02x%02x%02x',
            $this->aComponents['r']->getSize(),
            $this->aComponents['g']->getSize(),
            $this->aComponents['b']->getSize()
        );
        return '#' . (($sResult[0] == $sResult[1]) && ($sResult[2] == $sResult[3]) && ($sResult[4] == $sResult[5])
                ? "$sResult[0]$sResult[2]$sResult[4]" : $sResult);
    }
    return parent::render($oOutputFormat);
}