1 call to CSSmin::rgb_to_hex()
- CSSmin::hsl_to_hex in advagg_css_minify/yui/CSSMin.inc
File
-
advagg_css_minify/yui/CSSMin.inc, line 618
Class
- CSSmin
Code
private function rgb_to_hex($matches) {
if ($this->index_of($matches[1], '%') >= 0) {
$rgbcolors = explode(',', str_replace('%', '', $matches[1]));
for ($i = 0; $i < count($rgbcolors); $i++) {
$rgbcolors[$i] = $this->round_number(floatval($rgbcolors[$i]) * 2.55);
}
}
else {
$rgbcolors = explode(',', $matches[1]);
}
for ($i = 0; $i < count($rgbcolors); $i++) {
$rgbcolors[$i] = $this->clamp_number(intval($rgbcolors[$i], 10), 0, 255);
$rgbcolors[$i] = sprintf("%02x", $rgbcolors[$i]);
}
if (!preg_match('/[\\s\\,\\);\\}]/', $matches[2])) {
$matches[2] = ' ' . $matches[2];
}
return '#' . implode('', $rgbcolors) . $matches[2];
}