@@ -57,8 +57,8 @@ A custom theme file does two things:
57
57
1 . Imports the ` mat-core() ` sass mixin. This includes all common styles that are used by multiple
58
58
components. ** This should only be included once in your application.** If this mixin is included
59
59
multiple times, your application will end up with multiple copies of these common styles.
60
- 2 . Defines a ** theme** data structure as the composition of multiple palettes. This object can be
61
- created with either the ` mat-light-theme ` function or the ` mat-dark-theme ` function. The output of
60
+ 2 . Defines a ** theme** data structure as the composition of multiple palettes. This object can be
61
+ created with either the ` mat-light-theme ` function or the ` mat-dark-theme ` function. The output of
62
62
this function is then passed to the ` angular-material-theme ` mixin, which will output all of the
63
63
corresponding styles for the theme.
64
64
@@ -105,7 +105,7 @@ node-sass src/unicorn-app-theme.scss dist/unicorn-app-theme.css
105
105
and then include the output file in your index.html.
106
106
107
107
The theme file ** should not** be imported into other SCSS files. This will cause duplicate styles
108
- to be written into your CSS output. If you want to consume the theme definition object
108
+ to be written into your CSS output. If you want to consume the theme definition object
109
109
(e.g., ` $candy-app-theme ` ) in other SCSS files, then the definition of the theme object should be
110
110
broken into its own file, separate from the inclusion of the ` mat-core ` and
111
111
` angular-material-theme ` mixins.
@@ -119,8 +119,8 @@ styles will be subject to that component's [view encapsulation](https://angular.
119
119
You can create multiple themes for your application by including the ` angular-material-theme ` mixin
120
120
multiple times, where each inclusion is gated by an additional CSS class.
121
121
122
- Remember to only ever include the ` @mat-core ` mixin only once; it should not be included for each
123
- theme.
122
+ Remember to only ever include the ` @mat-core ` mixin only once; it should not be included for each
123
+ theme.
124
124
125
125
##### Example of defining multiple themes:
126
126
``` scss
@@ -148,25 +148,25 @@ $dark-warn: mat-palette($mat-deep-orange);
148
148
$dark-theme : mat-dark-theme ($dark-primary , $dark-accent , $dark-warn );
149
149
150
150
// Include the alternative theme styles inside of a block with a CSS class. You can make this
151
- // CSS class whatever you want. In this example, any component inside of an element with
152
- // `.unicorn-dark-theme` will be affected by this alternate dark theme instead of the default theme.
151
+ // CSS class whatever you want. In this example, any component inside of an element with
152
+ // `.unicorn-dark-theme` will be affected by this alternate dark theme instead of the default theme.
153
153
.unicorn-dark-theme {
154
154
@include angular-material-theme ($dark-theme );
155
155
}
156
156
```
157
157
158
- In the above example, any component inside of a parent with the ` unicorn-dark-theme ` class will use
158
+ In the above example, any component inside of a parent with the ` unicorn-dark-theme ` class will use
159
159
the dark theme, while other components will fall back to the default ` $candy-app-theme ` .
160
160
161
- You can include as many themes as you like in this manner. You can also ` @include ` the
162
- ` angular-material-theme ` in separate files and then lazily load them based on an end-user
161
+ You can include as many themes as you like in this manner. You can also ` @include ` the
162
+ ` angular-material-theme ` in separate files and then lazily load them based on an end-user
163
163
interaction (how to lazily load the CSS assets will vary based on your application).
164
164
165
165
It's important to remember, however, that the ` mat-core ` mixin should only ever be included _ once_ .
166
166
167
167
##### Multiple themes and overlay-based components
168
168
Since certain components (e.g. menu, select, dialog, etc.) are inside of a global overlay container,
169
- an additional step is required for those components to be affected by the theme's css class selector
169
+ an additional step is required for those components to be affected by the theme's css class selector
170
170
(` .unicorn-dark-theme ` in the example above).
171
171
172
172
To do this, you can specify a ` themeClass ` on the global overlay container. For the example above,
@@ -209,13 +209,13 @@ $candy-app-accent: mat-palette($mat-pink, A200, A100, A400);
209
209
$candy-app-theme : mat-light-theme ($candy-app-primary , $candy-app-accent );
210
210
211
211
// Include the theme styles for only specified components.
212
- @include mat-core-theme ($theme );
213
- @include mat-button-theme ($theme );
214
- @include mat-checkbox-theme ($theme );
212
+ @include mat-core-theme ($candy-app- theme );
213
+ @include mat-button-theme ($candy-app- theme );
214
+ @include mat-checkbox-theme ($candy-app- theme );
215
215
```
216
216
217
217
### Theming your own components
218
- For more details about theming your own components,
218
+ For more details about theming your own components,
219
219
see [ theming-your-components.md] ( ./theming-your-components.md )
220
220
221
221
### Future work
0 commit comments