Sha256: 71c9daf69cf7d09cf00f5c9f4ed463de0569977091c221f813d5e097733dd4cc

Contents?: true

Size: 1.05 KB

Versions: 66

Compression:

Stored size: 1.05 KB

Contents

@function modular-scale($value, $increment, $ratio) {
  @if $increment > 0 {
    @for $i from 1 through $increment {
      $value: ($value * $ratio);
    }
  }

  @if $increment < 0 {
    $increment: abs($increment);
    @for $i from 1 through $increment {
      $value: ($value / $ratio);
    }
  }

  @return $value;
}

//  div {
//                     Increment Up GR with positive value
//   font-size:        modular-scale(14px,   1, 1.618); // returns: 22.652px
//
//                     Increment Down GR with negative value
//   font-size:        modular-scale(14px,  -1, 1.618); // returns: 8.653px
//
//                     Can be used with ceil(round up) or floor(round down)
//   font-size: floor( modular-scale(14px, 1, 1.618) ); // returns: 22px
//   font-size:  ceil( modular-scale(14px, 1, 1.618) ); // returns: 23px
//  }
//
// modularscale.com

@function golden-ratio($value, $increment) {
  @return modular-scale($value, $increment, 1.618)
}

//  div {
//    font-size: golden-ratio(14px, 1); // returns: 22.652px
//  }
//
// goldenratiocalculator.com

Version data entries

66 entries across 66 versions & 9 rubygems

Version Path
daiblogs-0.2.1 _sass/bourbon/functions/_modular-scale.scss
daiblogs-0.2.0 _sass/bourbon/functions/_modular-scale.scss
daiblogs-0.1.5 _sass/bourbon/functions/_modular-scale.scss
daiblogs-0.1.4 _sass/bourbon/functions/_modular-scale.scss
daiblogs-0.1.2 assets/_sass/bourbon/functions/_modular-scale.scss
daiblogs-0.1.1 assets/_sass/bourbon/functions/_modular-scale.scss
daiblogs-0.1.0 assets/_sass/bourbon/functions/_modular-scale.scss
moovui-0.1.4 app/assets/stylesheets/bourbon/functions/_modular-scale.scss
stump-cli-0.1.3 lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/functions/_modular-scale.scss
stump-cli-0.1.2 lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/functions/_modular-scale.scss
moovui-0.1.3 app/assets/stylesheets/bourbon/functions/_modular-scale.scss
moovui-0.1.2 app/assets/stylesheets/bourbon/functions/_modular-scale.scss
moovui-0.1.1 app/assets/stylesheets/bourbon/functions/_modular-scale.scss
moovui-0.0.2 bourbon/functions/_modular-scale.scss
moovui-0.0.1 bourbon/functions/_modular-scale.scss
stump-cli-0.1.1 lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/functions/_modular-scale.scss
blogelator-0.2.5 vendor/assets/stylesheets/blogelator/bourbon/functions/_modular-scale.scss
blocky-0.0.11 vendor/assets/stylesheets/blocky/bourbon/functions/_modular-scale.scss
blogelator-0.2.4 vendor/assets/stylesheets/blogelator/bourbon/functions/_modular-scale.scss
blocky-0.0.10 vendor/assets/stylesheets/blocky/bourbon/functions/_modular-scale.scss