case self::COLOR_HEX_6:
return \
sprintf('#%02X%02X%02X',
$this->r,
$this->g,
$this->b
);
case self::COLOR_RGB:
if (1.0 ===
$this->a
) { return \
sprintf('rgb(%d, %d, %d)',
$this->r,
$this->g,
$this->b
);
} return \
sprintf('rgb(%d, %d, %d, %s)',
$this->r,
$this->g,
$this->b, \
round($this->a, 4
));
case self::COLOR_RGBA:
return \
sprintf('rgba(%d, %d, %d, %s)',
$this->r,
$this->g,
$this->b, \
round($this->a, 4
));
case self::COLOR_HSL:
$val = self::
rgbToHsl($this->r,
$this->g,
$this->b
);
if (1.0 ===
$this->a
) { return \
vsprintf('hsl(%d, %d%%, %d%%)',
$val);
} return \
sprintf('hsl(%d, %d%%, %d%%, %s)',
$val[0
],
$val[1
],
$val[2
], \
round($this->a, 4
));
case self::COLOR_HSLA:
$val = self::
rgbToHsl($this->r,
$this->g,
$this->b
);
return \
sprintf('hsla(%d, %d%%, %d%%, %s)',
$val[0
],
$val[1
],
$val[2
], \
round($this->a, 4
));
case self::COLOR_HEX_4:
if (0 ===
$this->r % 0x11 && 0 ===
$this->g % 0x11 && 0 ===
$this->b % 0x11 && 0
=== ((int) ($this->a * 255
)) % 0x11
) {