/** * * Get a Color object using /lib class.color * Convert to appropriate type * * @return string * */ function get_color($color, $type) { $c = new Jetpack_Color($color, 'rgb'); $this->color = $c; switch ($type) { case 'rgb': $color = implode($c->toRgbInt(), ','); break; case 'hex': $color = $c->toHex(); break; case 'hsv': $color = implode($c->toHsvInt(), ','); break; default: return $color = $c->toHex(); } return $color; }