diary-website

Website for diary
git clone https://git.in0rdr.ch/diary-website.git
Log | Files | Refs | Pull requests | README | LICENSE

_linear-gradient-parser.scss (1089B)


      1 @function _linear-gradient-parser($image) {
      2   $image: unquote($image);
      3   $gradients: ();
      4   $start: str-index($image, "(");
      5   $end: str-index($image, ",");
      6   $first-val: str-slice($image, $start + 1, $end - 1);
      7 
      8   $prefix: str-slice($image, 1, $start);
      9   $suffix: str-slice($image, $end, str-length($image));
     10 
     11   $has-multiple-vals: str-index($first-val, " ");
     12   $has-single-position: unquote(_position-flipper($first-val) + "");
     13   $has-angle: is-number(str-slice($first-val, 1, 1));
     14 
     15   @if $has-multiple-vals {
     16     $gradients: _linear-side-corner-parser($image, $first-val, $prefix, $suffix, $has-multiple-vals);
     17   }
     18 
     19   @else if $has-single-position != "" {
     20     $pos: unquote($has-single-position + "");
     21 
     22     $gradients: (
     23       webkit-image: -webkit- + $image,
     24       spec-image: $prefix + "to " + $pos + $suffix
     25     );
     26   }
     27 
     28   @else if $has-angle {
     29     // Rotate degree for webkit
     30     $gradients: _linear-angle-parser($image, $first-val, $prefix, $suffix);
     31   }
     32 
     33   @else {
     34     $gradients: (
     35       webkit-image: -webkit- + $image,
     36       spec-image: $image
     37     );
     38   }
     39 
     40   @return $gradients;
     41 }