Skip to content

Commit 07f5ed9

Browse files
committed
fix(material/schematics): add typography and density to custom theme (#28645)
Fixes that the template for a custom theme didn't include a typography config and a density. Fixes #28642. (cherry picked from commit dd97c0e)
1 parent d20edbf commit 07f5ed9

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

guides/theming.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ $my-theme: mat.define-light-theme((
193193
primary: $my-primary,
194194
accent: $my-accent,
195195
),
196+
typography: mat.define-typography-config(),
196197
density: 0,
197198
));
198199

@@ -536,14 +537,14 @@ the CSS in each shadow root, or by using [Constructable Stylesheets][constructab
536537

537538
## User preference media queries
538539

539-
Angular Material does not apply styles based on user preference media queries, such as
540+
Angular Material does not apply styles based on user preference media queries, such as
540541
`prefers-color-scheme` or `prefers-contrast`. Instead, Angular Material's Sass mixins give you the
541542
flexibility to apply theme styles to based on the conditions that make the most sense for your
542543
users. This may mean using media queries directly or reading a saved user preference.
543544

544545
## Style customization outside the theming system
545546

546-
Angular Material supports customizing color, typography, and density as outlined in this document.
547-
Angular strongly discourages, and does not directly support, overriding component CSS outside the
548-
theming APIs described above. Component DOM structure and CSS classes are considered private
547+
Angular Material supports customizing color, typography, and density as outlined in this document.
548+
Angular strongly discourages, and does not directly support, overriding component CSS outside the
549+
theming APIs described above. Component DOM structure and CSS classes are considered private
549550
implementation details that may change at any time.

src/material/schematics/ng-add/theming/create-custom-theme.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ $${name}-theme: mat.define-light-theme((
3535
primary: $${name}-primary,
3636
accent: $${name}-accent,
3737
warn: $${name}-warn,
38-
)
38+
),
39+
typography: mat.define-typography-config(),
40+
density: 0
3941
));
4042
4143
// Include theme styles for core and each component used in your app.

0 commit comments

Comments
 (0)