Skip to content

Commit 5f95339

Browse files
committed
docs: update documentation
1 parent ee03e24 commit 5f95339

File tree

1 file changed

+28
-18
lines changed

1 file changed

+28
-18
lines changed

README.md

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ You want to style your angular material dynamically with all the colors in the r
1414
```scss
1515
@use 'angular-material-css-vars/main' as mat-css;
1616
17-
// optional
18-
$mat-css-dark-theme-selector: '.isDarkTheme';
19-
$mat-css-light-theme-selector: '.isLightTheme';
20-
2117
// init theme
22-
@include mat-css.init-material-css-vars() using($mat-css-theme) {
18+
@include mat-css.init-material-css-vars(
19+
// optional
20+
$dark-theme-selector: '.isDarkTheme',
21+
$light-theme-selector: '.isLightTheme',
22+
) using($mat-css-theme) {
2323
// If your app has any theme mixins, call them here.
2424
// $mat-css-theme gets set to an appropriate value before this content is called.
2525
// @include your-custom-component-theme($mat-css-theme);
@@ -93,20 +93,23 @@ You can provide different options before initialization to change the body class
9393
@use 'angular-material-css-vars/main' as mat-css;
9494
...
9595
96-
// $mat-css-default-light-theme: ... ;
97-
// $mat-css-text: ... ;
98-
$mat-css-dark-theme-selector: '.isDarkTheme';
99-
$mat-css-light-theme-selector: '.isLightTheme';
100-
101-
@include mat-css.init-material-css-vars();
96+
@include mat-css.init-material-css-vars(
97+
// $default-light-theme: ... ;
98+
// $text: ... ;
99+
$dark-theme-selector: '.isDarkTheme',
100+
$light-theme-selector: '.isLightTheme',
101+
);
102102
103103
```
104104
To make those variables take effect with your mixins, you need to make sure that they are also defined before using them. E.g.:
105105
```scss
106+
@use 'angular-material-css-vars/main' as mat-css;
106107
@use 'angular-material-css-vars/public-util' as mat-css-utilities;
107108
108-
// probably best put in a common variables file and imported before the mixins
109-
$mat-css-dark-theme-selector: '.isDarkThemeCUSTOM';
109+
@include mat-css.init-material-css-vars(
110+
// probably best put in a common variables file and imported before the mixins
111+
$dark-theme-selector: '.isDarkTheme',
112+
);
110113
111114
.my-component {
112115
@include mat-css-utilities.mat-css-dark-theme {
@@ -181,19 +184,26 @@ $custom-typography: mat.mat-typography-config(
181184
@include mat-css-main.init-material-css-vars($typography-config: $custom-typography) using($mat-css-theme) {
182185
@include app-theme($mat-css-theme);
183186
};
187+
188+
@mixin app-theme($theme) {
189+
// Your app theme
190+
}
184191
```
185192
186193
## Legacy components support
187194
Angular Material v15 introduces MDC based components, which is basically a re-write for a lot of the available components. `angular-material-css-vars` v5+ only supports MDC components.
188195
189196
In case you are still using the legacy components, you can use the package [angular-material-css-vars-legacy](https://github.com/json-derulo/angular-material-css-vars-legacy).
190197
191-
## upgrading to angular v12
192-
Angular material v12 interoduces some big changes, which leaves you with two options when upgrading to ng12: You can either stay at angular material v11 and angular-material-css-vars v1.2.0 or you can use v2+ which thanks to @pedrojrivera adds full support for the new version.
193-
194-
## angular material v11 or lower
195-
Use v1.2.0 of this lib.
198+
## Angular compatibility table
196199
200+
| Angular | angular-material-css-vars |
201+
|---------|---------------------------|
202+
| 16 | 5.x |
203+
| 15 | 4.x |
204+
| 13/14 | 3.x |
205+
| 12 | 2.x |
206+
| 11 | 1.x |
197207
198208
## Credit...
199209
...goes to @zbirizdo [project](https://github.com/zbirizdo/material-css-vars) on which parts of this are based which is in turn supposedly based on [this gist](https://gist.github.com/shprink/c7f333e3ad51830f14a6383f3ab35439).

0 commit comments

Comments
 (0)