Created
August 19, 2015 20:53
-
-
Save dmitry-ilyashevich/5ab631b3723cd89f371d to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---- | |
// libsass (v3.2.4) | |
// ---- | |
@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 | |
//and the variables: | |
$golden: 1.618; | |
$minor-second: 1.067; | |
$major-second: 1.125; | |
$minor-third: 1.2; | |
$major-third: 1.25; | |
$perfect-fourth: 1.333; | |
$augmented-fourth: 1.414; | |
$perfect-fifth: 1.5; | |
$minor-sixth: 1.6; | |
$major-sixth: 1.667; | |
$minor-seventh: 1.778; | |
$major-seventh: 1.875; | |
$octave: 2; | |
$major-tenth: 2.5; | |
$major-eleventh: 2.667; | |
$major-twelfth: 3; | |
$double-octave: 4; | |
@function golden-ratio($value, $increment) { | |
@return modular-scale($value, $increment, $golden) | |
} | |
// div { | |
// font-size: golden-ratio(14px, 1); // returns: 22.652px | |
// } | |
// | |
// goldenratiocalculator.com | |
div { | |
font-size: floor(golden-ratio(14px, 1)); // returns: 22.652px | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
div { | |
font-size: 22px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment