Skip to content

Instantly share code, notes, and snippets.

@rpkoller
Last active December 31, 2015 13:29
Show Gist options
  • Save rpkoller/7992795 to your computer and use it in GitHub Desktop.
Save rpkoller/7992795 to your computer and use it in GitHub Desktop.
Two modular scales applied to the Compass Vertical Rhythm module
@import 'compass';
@import 'modular-scale';
@import 'toolkit';
@import 'breakpoint';
//mixin taken from the following pull request https://github.com/chriseppstein/compass/pull/1352
@mixin use-baseline($new-base-size, $new-line-height) {
// Save the baseline context
$initial-font-size: $base-font-size;
$initial-line-height: $base-line-height;
// Apply the new context
$base-font-size: $new-base-size;
$base-line-height: $new-line-height;
@content;
// Reapply the initial context
$base-font-size: $initial-font-size;
$base-line-height: $initial-line-height;
}
$base-size: 20px 44px;
$ratio:major-third() fifth();
@include ms-list-output(-6, 12, $base-size, $ratio);
$mod-6: ms(-6);
$mod-5: ms(-5);
$mod-4: ms(-4);
$mod-3: ms(-3);
$mod-2: ms(-2);
$mod-1: ms(-1);
$mod0: ms(0);
$mod1: ms(1);
$mod2: ms(2);
$mod3: ms(3);
$mod4: ms(4);
$mod5: ms(5);
$mod6: ms(6);
$mod7: ms(7);
$mod8: ms(8);
$mod9: ms(9);
$mod10: ms(10);
$mod11: ms(11);
$mod12: ms(12);
$base-size: 26px 120px;
$ratio:golden() fifth();
@include ms-list-output(-6, 12, $base-size, $ratio);
$mood-6: ms(-6);
$mood-5: ms(-5);
$mood-4: ms(-4);
$mood-3: ms(-3);
$mood-2: ms(-2);
$mood-1: ms(-1);
$mood0: ms(0);
$mood1: ms(1);
$mood2: ms(2);
$mood3: ms(3);
$mood4: ms(4);
$mood5: ms(5);
$mood6: ms(6);
$mood7: ms(7);
$mood8: ms(8);
$mood9: ms(9);
$mood10: ms(10);
$mood11: ms(11);
$mood12: ms(12);
$base-font-size: $mod0;
$base-line-height: 28px;
@include establish-baseline($mod0);
@include breakpoint(750px) {
@include use-baseline(26px, 32px) {
//$base-font-size: 26px;
//$base-line-height: 32px;
@include establish-baseline($mood0);
}
}
h1 {
@include adjust-font-size-to($mod2);
@include breakpoint(750px) {
@include use-baseline(26px, 34px) {
@include adjust-font-size-to($mood2);
}
}
}
h2 {
@include adjust-font-size-to($mod1);
@include breakpoint(750px) {
@include use-baseline(26px, 34px) {
@include adjust-font-size-to($mood1);
}
}
}
p {
@include adjust-font-size-to($mod0);
@include breakpoint(750px) {
@include use-baseline(26px, 34px) {
@include adjust-font-size-to($mood0);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment