Created
October 2, 2013 16:16
-
-
Save paceaux/6796255 to your computer and use it in GitHub Desktop.
Stylus font functions. Add this to a vars.styl file that you would import all over the place.
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
//========== root values | |
phi = 1.618 | |
fi = .618 | |
golden = 1.61803398875 | |
rootPx = 16px | |
rootEm = 1em | |
rootPercent = 100% | |
rootPt = pxToPt(rootPx) | |
//========== font functions | |
hifi() | |
unit(phi, 'em') | |
lofi() | |
unit(fi, 'em') | |
rem(n) | |
rootEm * n | |
pxToPt(n) | |
unit(.75 * n,pt) | |
ptToPx(n) | |
ceil(unit(n * 1.333333333,px)) | |
ptToEm(n) | |
unit(ptToPx(n) / rootPx,em) | |
emToPx(n) | |
unit(n * 16,px) | |
pxToEm(n) | |
unit(n/rootEm,em) | |
emToPercent(n) | |
(n/rootEm)% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment