You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/material/schematics/ng-generate/m3-theme/README.md
+58-26Lines changed: 58 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,44 +4,76 @@
4
4
ng generate @angular/material:m3-theme
5
5
```
6
6
7
-
This schematic allows users to create new Material 3 theme configurations based
7
+
This schematic allows users to create new Material 3 theme palettes based
8
8
on custom colors by using [Material Color Utilities](https://github.com/material-foundation/material-color-utilities).
9
9
10
10
The generated [color palettes](https://m3.material.io/styles/color/roles) are
11
11
optimized to have enough contrast to be more accessible. See [Science of Color Design](https://material.io/blog/science-of-color-design) for more information about Material's color design.
12
12
13
-
For more customization, custom palette colors can be also be provided for the
14
-
secondary, tertiary, and neutral colors. It is recommended to choose colors that
13
+
For more customization, custom colors can be also be provided for the
14
+
secondary, tertiary, and neutral palette colors. It is recommended to choose colors that
15
15
are contrastful, Material has more detailed guidance for [accessible design](https://m3.material.io/foundations/accessible-design/patterns).
16
16
17
17
The output of the schematic will create a file named `m3-theme.scss` at the
18
-
specified directory or the project root with the generated themes. The exported
19
-
themes (`$light-theme` and/or `$dark-theme`) can be provided to component theme
20
-
mixins.
21
-
22
-
If you're using the system variables option, you should remember to either provide values for the
23
-
system variables (all prefixed with `--sys-`), or to include the `system-level-colors` and
24
-
`system-level-typography` mixins which will generate the values based on your theme.
25
-
26
-
The default prefix for system variables is `--sys-`. This prefix can be customized. For
27
-
example, to change the prefix to `--md-sys-`, use the following configuration at the color or typography level:
28
-
`system-prefix: md-sys`.
18
+
specified directory or the project root with the generated palettes. The exported
19
+
palettes (`$primary-palette` and `$tertiary-palette`) can be provided to the `private-experimental-theme` mixin within your theme file to use the custom colors.
29
20
30
21
```scss
31
22
@use'@angular/material'asmat;
32
-
@use'./path/to/my-theme';
23
+
@use'./path/to/my-theme';// location of generated file
33
24
34
-
@includemat.core();
25
+
html {
26
+
@includemat.private-experimental-theme(
27
+
color: (
28
+
primary: my-theme.$primary-palette,
29
+
tertiary: my-theme.$tertiary-palette,
30
+
),
31
+
typography: Roboto,
32
+
density: 0,
33
+
)
34
+
}
35
+
```
36
+
37
+
High contrast override theme mixins are also generated in the file if specified
38
+
(`high-contrast-light-theme-overrides` and `high-contrast-dark-theme-overrides`). These mixins
39
+
override the system level variables with high contrast equivalent values from your theme. This is
40
+
helpful for users who prefer more contrastful colors for either preference or accessibility reasons.
41
+
42
+
```scss
43
+
@use'@angular/material';
44
+
@use'./path/to/my-theme'; // location of generated file
35
45
36
46
html {
37
47
// Apply the light theme by default
38
-
@includemat.core-theme(my-theme.$light-theme);
39
-
@includemat.button-theme(my-theme.$light-theme);
40
-
41
-
// When using system variables, remember to provide values for them
42
-
// or uncomment the lines below to generate them from the theme.
0 commit comments