Exemple #1
0
 public static function css2rgba($css)
 {
     if (strpos($css, "hsl(") !== false) {
         $hsl = str_replace(["%", "hsl(", ")"], '', $css);
         return Convert::hsl2rgba($hsl);
     } else {
         if (strpos($css, "rgb(") !== false) {
             $rgb = str_replace(["rgb(", ")"], '', $css);
             return Convert::rgb2rgba($rgb);
         } else {
             if (strpos($css, "#") !== false) {
                 $hex = str_replace("#", '', $css);
                 return Convert::hex2rgba($hex);
             } else {
                 if (strpos($css, "hsla(") !== false) {
                     $hsla = str_replace(["%", "hsla(", ")"], '', $css);
                     return Convert::hsla2rgba($hsla);
                 } else {
                     if (strpos($css, "rgba(") !== false) {
                         $rgba = str_replace(["rgba(", ")"], '', $css);
                         return $rgba;
                     }
                 }
             }
         }
     }
 }