Пример #1
0
 public static function css2hsla($css)
 {
     if (strpos($css, "hsl(") !== false) {
         $hsl = str_replace(["%", "hsl(", ")", " "], '', $css);
         return Convert::hsl2hsla($hsl);
     } else {
         if (strpos($css, "rgb(") !== false) {
             $rgb = str_replace(["rgb(", ")", " "], '', $css);
             return Convert::rgb2hsla($rgb);
         } else {
             if (strpos($css, "#") !== false) {
                 $hex = str_replace(["#", " "], '', $css);
                 return Convert::hex2hsla($hex);
             } else {
                 if (strpos($css, "hsla(") !== false) {
                     $hsla = str_replace(["%", "hsla(", ")"], '', $css);
                     return $hsla;
                 } else {
                     if (strpos($css, "rgba(") !== false) {
                         $rgba = str_replace(["rgba(", ")"], '', $css);
                         return Convert::rgba2hsla($rgba);
                     }
                 }
             }
         }
     }
 }