Add automatic type scaling based on modular scales#2
Add automatic type scaling based on modular scales#2Cleecanth wants to merge 4 commits intocsswizardry:masterfrom
Conversation
Using the principles from Tim Brown's "More Meaningful Typography", users can now set automatic heading sizes. - Added exponent function to remove compass dependency. - Added Modular Scale function. - Added loop for automatic heading creation.
|
Funny, I just started using typcecsset in a new project last night and also integrated https://github.com/Team-Sass/modular-scale (2.x) to do exactly this (applying modular scales to headings, etc.). There are two things I really like about the modular-scale (2.x) project that I'd like typecsset to play nice with or replicate:
Even more awesome would be having functions to convert to/from pixel/rem units, and add leading/trailing line spaces (with pixel fallbacks) to arbitrary elements to maintain the baseline when applying modular scales. |
|
I'll be adding a commit tomorrow to expose the modular scale as a mixin that can be used for any property. Something like (where 1 is the desired scale increment): Which would output to something like: Using negative numbers will allow you to go down the scale (just a nice side effect of the algorithm). |
|
@Cleecanth, I look forward to seeing how this turns out. What do you think about specifying the $typecsset-ratio as an integer instead? (e.g. the scale values shown at http://type-scale.com/) |
Exposed the modular scale to users via a mixin, using the syntax: typecsset(x, property), and made typecsset-ratio more versatile. - Added function to allow floats in typecsset-ratio . -Added function to ensure typecsset-ratio is >= 1. -Added documentation for new mixin and additional typecsset-ratio functionality to README.
Using modular scale principles (http://alistapart.com/article/more-meaningful-typography), I added the option for automatic heading scaling.
This still uses the typecsset base functions/mixins, but allows the user to create a typographic scale for slightly more harmonious type scaling.
Some of this might be able to be cleaned up, but the functions work as suggested.
Future possibility: