cv-website

Personal website and CV
git clone https://git.in0rdr.ch/cv-website.git
Log | Files | Refs | Pull requests |Archive | README | LICENSE

_radial-gradient-parser.scss (1282B)


      1 @function _radial-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   $is-spec-syntax: str-index($first-val, "at");
     12 
     13   @if $is-spec-syntax and $is-spec-syntax > 1 {
     14     $keyword: str-slice($first-val, 1, $is-spec-syntax - 2);
     15     $pos: str-slice($first-val, $is-spec-syntax + 3, str-length($first-val));
     16     $pos: append($pos, $keyword, comma);
     17 
     18     $gradients: (
     19       webkit-image: -webkit- + $prefix + $pos + $suffix,
     20       spec-image: $image
     21     );
     22   }
     23 
     24   @else if $is-spec-syntax == 1 {
     25     $pos: str-slice($first-val, $is-spec-syntax + 3, str-length($first-val));
     26 
     27     $gradients: (
     28       webkit-image: -webkit- + $prefix + $pos + $suffix,
     29       spec-image: $image
     30     );
     31   }
     32 
     33   @else if str-index($image, "cover") or str-index($image, "contain") {
     34     @warn "Radial-gradient needs to be updated to conform to latest spec.";
     35 
     36     $gradients: (
     37       webkit-image: null,
     38       spec-image: $image
     39     );
     40   }
     41 
     42   @else {
     43     $gradients: (
     44       webkit-image: -webkit- + $image,
     45       spec-image: $image
     46     );
     47   }
     48 
     49   @return $gradients;
     50 }