Sha256: 3dd4428cbcd61cc9448dba40ae008308eb0c66d00c91eb5d3ec1829ab38cb372

Contents?: true

Size: 862 Bytes

Versions: 4

Compression:

Stored size: 862 Bytes

Contents

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

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

  @return $value;
}

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bourbon-1.3.3 app/assets/stylesheets/functions/_golden-ratio.scss
bourbon-1.3.2 app/assets/stylesheets/functions/_golden-ratio.scss
bourbon-1.3.0 app/assets/stylesheets/functions/_golden-ratio.scss
bourbon-1.2.0 app/assets/stylesheets/functions/_golden-ratio.scss