4 ms·
Another option for creating a customizable, consistent font scale and spacing is my Typography.js project http://kyleamathews.github.io/typography.js/ http://ky
by kylemathews 10y ago
Another option for creating a customizable, consistent font scale and spacing is my Typography.js project http://kyleamathews.github.io/typography.js/ http://kyleamathews.github.io/typography.js/
It's a JS library that you provide a configuration object and it generates your type/spacing CSS. I love Tachyons and am planning on building a plugin for Typography.js which will generate tachyon-like classes.
https://github.com/kyleamathews/typography.js https://github.com/kyleamathews/typography.js
- kylemathews 10y agoYou can use it with css-in-js libs like styled-components as well. It exports two helper functions, "rhythm" and "scale". "rhythm" is a virtual unit that's the distance of one line-height. All spacing within Typography.js are based on it. Using "rhythms" for other spacings on your site ensures everything stays consistent as you make styling tweaks. "scale" is a function to pick font sizes off the scale you setup (with scaleRatio). This let's you tweak the body font size and all other font sizes will move along with that.