Skip to content

Instantly share code, notes, and snippets.

@CharlieGreenman
Created September 3, 2019 12:37
Show Gist options
  • Save CharlieGreenman/67f85a24a13f9714c2326ff8b50a9d0d to your computer and use it in GitHub Desktop.
Save CharlieGreenman/67f85a24a13f9714c2326ff8b50a9d0d to your computer and use it in GitHub Desktop.
Angular Material Themes Sass file - mat-tyopgraphy-config file
// Represents a collection of typography levels.
// Defaults come from https://material.io/guidelines/style/typography.html
// Note: The spec doesn't mention letter spacing. The values here come from
// eyeballing it until it looked exactly like the spec examples.
@function mat-typography-config(
$font-family: 'Roboto, "Helvetica Neue", sans-serif',
// Large, one-off header, usually at the top of the page (e.g. a hero header).
$display-4: mat-typography-level(112px, 112px, 300, $letter-spacing: -0.05em),
// Large, one-off header, usually at the top of the page (e.g. a hero header).
$display-3: mat-typography-level(56px, 56px, 400, $letter-spacing: -0.02em),
// Large, one-off header, usually at the top of the page (e.g. a hero header).
$display-2: mat-typography-level(45px, 48px, 400, $letter-spacing: -0.005em),
// Large, one-off header, usually at the top of the page (e.g. a hero header).
$display-1: mat-typography-level(34px, 40px, 400),
// Section heading corresponding to the <h1> tag.
$headline: mat-typography-level(24px, 32px, 400),
// Section heading corresponding to the <h2> tag.
$title: mat-typography-level(20px, 32px, 500),
// Section heading corresponding to the <h3> tag.
$subheading-2: mat-typography-level(16px, 28px, 400),
// Section heading corresponding to the <h4> tag.
$subheading-1: mat-typography-level(15px, 24px, 400),
// Bolder body text.
$body-2: mat-typography-level(14px, 24px, 500),
// Base body text.
$body-1: mat-typography-level(14px, 20px, 400),
// Smaller body and hint text.
$caption: mat-typography-level(12px, 20px, 400),
// Buttons and anchors.
$button: mat-typography-level(14px, 14px, 500),
// Line-height must be unit-less fraction of the font-size.
// Form input fields.
$input: mat-typography-level(inherit, 1.125, 400)
) {
// ..rest of function goes here
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment