Problem/Motivation
Font size and line height values are set inconsistently throughout the theme. In an attempt to address this and provide more consistency across a site and more easily follow how our designers approach typography, we want to implement a type system based on a typographic scale.
Proposed resolution
Add a new type scale sass map along with the needed mixins to convert it into a series of css custom properties. Update existing font-size and line-height declarations.
$typographic-scale: (
category1: (
size1: (
breakpoint1: (fontSizePixelValue, lineHeightPixelValue),
breakpoint2: (fontSizePixelValue, lineHeightPixelValue),
...
),
size2: ( ... ),
...
),
category2: ( ... ),
...
);Example...
$typographic-scale: (
heading: (
96: (
mobile: (44, 52),
tablet: (52, 60),
sm-desktop: (72, 72),
desktop: (96, 92),
),
52: (
mobile: (32, 36),
tablet: (42, 48),
sm-desktop: (44, 52),
desktop: (52, 60),
),
...
body: (
...
)
);
Usage
h1 {
@include type-scale(heading, 96);
}
Remaining tasks
Review the general approach. Determine the minimum default type-scale needed out of the box.
API changes
The @mixin font() has been replaced with a slightly different @mixin type-scale().
Issue fork prototype-3417984
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
pixelwhip commentedComment #4
pixelwhip commentedComment #6
jldust commentedComment #8
jldust commentedThis looks great and has been merged into the 5.x branch, we will include it in the next tagged release.
Comment #9
jldust commented