-
-
Save zhouzi/2ab48c9b30b2a1a93c72 to your computer and use it in GitHub Desktop.
Modular scale for font sizing with power math function
This file contains 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
// http://www.modularscale.com/ | |
// http://webdesign.tutsplus.com/articles/how-to-establish-a-modular-typographic-scale--webdesign-14927 | |
@function pow ($x, $n) { | |
$ret: 1; | |
@if $n >= 0 { | |
@for $i from 0 to $n { | |
$ret: $ret * $x; | |
} | |
} @else { | |
@for $i from $n to 0 { | |
$ret: $ret / $x; | |
} | |
} | |
@return $ret; | |
} | |
@function ms ($n, $base: $ms-base, $ratio: $ms-ratio) { | |
@return pow($ratio, $n) * $base; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment