PHPFusion\Atom\Atom::parse_background PHP Метод

parse_background() приватный Метод

* Background parser
private parse_background ( $hex, $fill_type )
    private function parse_background($hex, $fill_type)
    {
        // possible fill types in atom
        // darken or lighten functions via steps of 255 max.
        $hex_value = str_replace('#', '', $hex);
        $stop_hex = $this->adjustBrightness($hex_value, -20);
        switch ($fill_type) {
            case 0:
                // flat
                return $hex;
                break;
            case 1:
                // horizontal
                return "\n\t\t\t\t\tbackground: " . $hex . ";\n\t\t\t\t  \tbackground: -moz-linear-gradient(left, " . $hex . " 0%, " . $stop_hex . " 100%);\n\t\t\t\t  \tbackground: -webkit-gradient(linear, left top, right top, color-stop(0%, " . $hex . "), color-stop(100%, " . $stop_hex . "));\n\t\t\t\t  \tbackground: -webkit-linear-gradient(left, " . $hex . " 0%," . $stop_hex . " 100%);\n\t\t\t\t  \tbackground: -o-linear-gradient(left, " . $hex . " 0%," . $stop_hex . " 100%);\n\t\t\t\t  \tbackground: -ms-linear-gradient(left, " . $hex . " 0%," . $stop_hex . " 100%);\n\t\t\t\t  \tbackground: linear-gradient(to right, " . $hex . " 0%," . $stop_hex . " 100%);\n\t\t\t\t  \tfilter: progid:DXImageTransform.Microsoft.gradient( startColorstr='" . $hex . "', endColorstr='" . $stop_hex . "',GradientType=1 );\n\t\t\t\t";
                break;
            case 2:
                // vertical
                return "\n\t\t\t\t\tbackground: " . $hex . ";\n\t\t\t\t  \tbackground: -moz-linear-gradient(top, " . $hex . " 0%, " . $stop_hex . " 100%);\n\t\t\t\t  \tbackground: -webkit-gradient(linear, left top, left bottom, color-stop(0%," . $hex . "), color-stop(100%," . $stop_hex . "));\n\t\t\t\t  \tbackground: -webkit-linear-gradient(top, " . $hex . " 0%," . $stop_hex . " 100%);\n\t\t\t\t  \tbackground: -o-linear-gradient(top, " . $hex . " 0%," . $stop_hex . " 100%);\n\t\t\t\t  \tbackground: -ms-linear-gradient(top, " . $hex . " 0%," . $stop_hex . " 100%);\n\t\t\t\t  \tbackground: linear-gradient(to bottom, " . $hex . " 0%," . $stop_hex . " 100%);\n\t\t\t\t  \tfilter: progid:DXImageTransform.Microsoft.gradient( startColorstr='" . $hex . "', endColorstr='" . $stop_hex . "',GradientType=0 );\n\t\t\t\t";
                break;
            case 3:
                //radial
                return "\n\t\t\t\t\tbackground: " . $hex . ";\n\t\t\t\t  \tbackground: -moz-radial-gradient(center, ellipse cover, " . $hex . " 0%, " . $stop_hex . " 100%);\n\t\t\t\t  \tbackground: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%," . $hex . "), color-stop(100%," . $stop_hex . "));\n\t\t\t\t  \tbackground: -webkit-radial-gradient(center, ellipse cover, " . $hex . " 0%," . $stop_hex . " 100%);\n\t\t\t\t  \tbackground: -o-radial-gradient(center, ellipse cover, " . $hex . " 0%," . $stop_hex . " 100%);\n\t\t\t\t  \tbackground: -ms-radial-gradient(center, ellipse cover, " . $hex . " 0%," . $stop_hex . " 100%);\n\t\t\t\t  \tbackground: radial-gradient(ellipse at center, " . $hex . " 0%," . $stop_hex . " 100%);\n\t\t\t\t  \tfilter: progid:DXImageTransform.Microsoft.gradient( startColorstr='" . $hex . "', endColorstr='" . $stop_hex . "',GradientType=1 );\n\t\t\t\t";
                break;
            case 4:
                // diagonal
                return "\n\t\t\t\t\tbackground: " . $hex . ";\n  \t\t\t\t\tbackground: -moz-linear-gradient(-45deg, " . $hex . " 0%, " . $stop_hex . " 100%);\n  \t\t\t\t\tbackground: -webkit-gradient(linear, left top, right bottom, color-stop(0%," . $hex . "), color-stop(100%," . $stop_hex . "));\n  \t\t\t\t\tbackground: -webkit-linear-gradient(-45deg, " . $hex . " 0%," . $stop_hex . " 100%);\n  \t\t\t\t\tbackground: -o-linear-gradient(-45deg, " . $hex . " 0%," . $stop_hex . " 100%);\n  \t\t\t\t\tbackground: -ms-linear-gradient(-45deg, " . $hex . " 0%," . $stop_hex . " 100%);\n  \t\t\t\t\tbackground: linear-gradient(135deg, " . $hex . " 0%," . $stop_hex . " 100%);\n  \t\t\t\t\tfilter: progid:DXImageTransform.Microsoft.gradient( startColorstr='" . $hex . "', endColorstr='" . $stop_hex . "',GradientType=1);\n\t\t\t\t";
                break;
            default:
                return $hex;
        }
    }