GutenType is a Sass library that generates correct typographic styles. See the demo.
@use "guten-type";
article {
@include guten-type.press();
}
@use "guten-type";
article {
@include guten-type.set(
$font-size: 20px,
$font-stack: (
"serif": (
Baskerville,
),
"sans": (
Helvetica,
),
"mono": (
Consolas,
),
)
);
@include guten-type.press();
}
-
The body text's font-size. Must be in px. This is automatically scaled smaller for elements like captions, code, etc.
-
Default:
18px
-
The various serif, sans-serif, and monospace fonts used for all text.
-
Default:
( "serif": ( "Iowan Old Style", "Palatino Linotype", "URW Palladio L", P052, serif, ), "sans": ( Inter, Roboto, "Helvetica Neue", "Arial Nova", "Nimbus Sans", Arial, sans-serif, ), "mono": ( ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace, ) )
-
The body text's line-height. This is automatically scaled smaller for headings.
-
Default:
1.5
-
normal
is used for text.light
is used for lines (tables, hr, etc.).action
is used for links. -
Default:
( "normal": rgba(1, 2, 3, 0.95), "light": rgba(0, 0, 0, 0.55), "action": rgba(1, 2, 3, 0.95), )
-
The size of line breaks. Must be in rem.
-
Default:
1rem * $line-height
-
The typographic scale for heading font-size.
E.g. given a
start
value of4
, the scale starts at h4. h4's font-size gets calculated as follows:h4-font-size
=$font-size
*base
.
Then, the remaining headings scale exponentially:
-
h3-font-size
=h4-font-size
*ratio
1 -
h2-font-size
=h4-font-size
*ratio
2 -
h1-font-size
=h4-font-size
*ratio
3
-
Default:
( "start": 4, "base": 1.33333, "ratio": 1.25, )
-
Same concept as
$font-size-scale
. -
Default:
( "start": 4, "base": 1.5, "ratio": 1.33333, )