Sha256: 06d50f3c470ac34137492a4be74de49bfab24507dbc5c7dccd84a343a4e7a68e

Contents?: true

Size: 967 Bytes

Versions: 17

Compression:

Stored size: 967 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
//    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

17 entries across 17 versions & 1 rubygems

Version Path
bourbon-1.1.0 app/assets/stylesheets/functions/_golden-ratio.scss
bourbon-1.0.4 app/assets/stylesheets/functions/_golden-ratio.scss
bourbon-1.0.3 app/assets/stylesheets/functions/_golden-ratio.scss
bourbon-1.0.2 app/assets/stylesheets/functions/_golden-ratio.scss
bourbon-1.0.1 app/assets/stylesheets/functions/_golden-ratio.scss
bourbon-1.0.0 app/assets/stylesheets/functions/_golden-ratio.scss
bourbon-0.2.1 app/assets/stylesheets/functions/_golden-ratio.scss
bourbon-0.2.0 app/assets/stylesheets/functions/_golden-ratio.scss
bourbon-0.1.9 app/assets/stylesheets/functions/_golden-ratio.scss
bourbon-0.1.8 app/assets/stylesheets/functions/_golden-ratio.scss
bourbon-0.1.7 app/assets/stylesheets/functions/_golden-ratio.scss
bourbon-0.1.6 app/assets/stylesheets/functions/_golden-ratio.scss
bourbon-0.1.5 app/assets/stylesheets/functions/_golden-ratio.scss
bourbon-0.1.4 app/assets/stylesheets/functions/_golden-ratio.scss
bourbon-0.1.3 app/assets/stylesheets/functions/_golden-ratio.css.scss
bourbon-0.1.2 app/assets/stylesheets/functions/_golden-ratio.css.scss
bourbon-0.1.1 app/assets/stylesheets/functions/_golden-ratio.css.scss