Sha256: 85eb575d4292551452b9bdbc4f4752f62ca11e52281f4fec714b8eba6ba34be4

Contents?: true

Size: 940 Bytes

Versions: 2

Compression:

Stored size: 940 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);
    }
  }
  @if $increment == 0 {
    @warn "Increment value cannot be zero; must be ...-3, -2, -1, 1, 2, 3...";
  }
  @return $value;
}

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bourbon-0.0.8 app/assets/stylesheets/functions/_golden-ratio.css.scss
bourbon-0.0.7 app/assets/stylesheets/functions/_golden-ratio.css.scss