Skip to content

Instantly share code, notes, and snippets.

@koycarraway
Last active August 29, 2015 14:05
Show Gist options
  • Save koycarraway/4a2b5eef7fc7f19ab8be to your computer and use it in GitHub Desktop.
Save koycarraway/4a2b5eef7fc7f19ab8be to your computer and use it in GitHub Desktop.
H&Co Typography Mixin
// H&Co Typography mixin -------------------------------------------------------------
//
// $fontFamily: gotham, Sentinel, whitney
// $fontWeight: light, book, medium, semibold, bold, black
// $SSm: true, false (ScreenSmart Font?)
// $fontStyle: normal, italic
//
// USAGE: @include HoefFont(gotham, bold, true);
@function capitalize($string) {
@return to-upper-case(str-slice($string, 1, 1)) + str-slice($string, 2);
}
@mixin HoefFont($fontFamily, $fontWeight, $SSm: true, $fontStyle: normal) {
$fontFamily: capitalize($fontFamily);
$fontWeights: (
xlight: 200,
light: 300,
book: 400,
medium: 500,
semibold: 600,
bold: 700,
black: 800,
);
$fontWeight: map-get($fontWeights, $fontWeight);
@if $SSm == true {
font-family: '#{$fontFamily} SSm A', '#{$fontFamily} SSm B';
} @else {
font-family: '#{$fontFamily} A', '#{$fontFamily} B';
}
font-weight: $fontWeight;
font-style: $fontStyle;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment