Sha256: 2deb4b54942d962023e1e457c4b5932f09fc2033cf9b99bbe71013884a40be57

Contents?: true

Size: 1.06 KB

Versions: 12

Compression:

Stored size: 1.06 KB

Contents

/* ==========================================================================
   Fluid Type
   as seen on https://madebymike.com.au/writing/fluid-type-calc-examples/
   ========================================================================== */

@function strip-unit($value) {
  @return $value / ($value * 0 + 1);
}

@mixin fluid-type($min-vw, $max-vw, $min-font-size, $max-font-size) {
  // scss-lint:disable UnnecessaryParentReference
  $u1: unit($min-vw);
  $u2: unit($max-vw);
  $u3: unit($min-font-size);
  $u4: unit($max-font-size);

  @if $u1 == $u2 and $u1 == $u3 and $u1 == $u4 {
    & {

      font-size: $min-font-size;

      @media screen and (min-width: $min-vw) {
        font-size: calc(#{$min-font-size} + #{strip-unit($max-font-size - $min-font-size)} * ((100vw - #{$min-vw}) / #{strip-unit($max-vw - $min-vw)}));
      }

      @media screen and (min-width: $max-vw) {
        font-size: $max-font-size;
      }
    }
  } @else {
    @error "Detected mixed units. Please use the same units for all parameters. " + $u1 +", " + $u2 + ", " + $u3 +", "+ $u4;
  }
}

Version data entries

12 entries across 12 versions & 3 rubygems

Version Path
jekyll-theme-basically-basic-1.4.5 _sass/basically-basic/functions/_fluid-type.scss
jekyll-theme-so-simple-libre-4.0.0 _sass/so-simple/functions/_fluid-type.scss
jekyll-theme-so-simple-3.2.0 _sass/so-simple/functions/_fluid-type.scss
jekyll-theme-so-simple-3.1.3 _sass/so-simple/functions/_fluid-type.scss
jekyll-theme-basically-basic-1.4.4 _sass/basically-basic/functions/_fluid-type.scss
jekyll-theme-basically-basic-1.4.3 _sass/basically-basic/functions/_fluid-type.scss
jekyll-theme-basically-basic-1.4.2 _sass/basically-basic/functions/_fluid-type.scss
jekyll-theme-so-simple-3.1.2 _sass/so-simple/functions/_fluid-type.scss
jekyll-theme-basically-basic-1.4.1 _sass/basically-basic/functions/_fluid-type.scss
jekyll-theme-so-simple-3.1.1 _sass/so-simple/functions/_fluid-type.scss
jekyll-theme-basically-basic-1.4.0 _sass/basically-basic/functions/_fluid-type.scss
jekyll-theme-basically-basic-1.0.0 _sass/basically-basic/mixins/_fluid-type.scss