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
@@ -34,16 +25,15 @@ import {MaterialCssVarsModule} from 'angular-material-css-vars';
34
25
MaterialCssVarsModule.forRoot({
35
26
// all optional
36
27
isAutoContrast: true,
37
-
darkThemeClass: 'isDarkTheme',
38
-
lightThemeClass: 'isLightTheme',
28
+
primary: '#3f51b5',
39
29
// ...
40
30
}),
41
31
],
42
32
})
43
33
export class AppModule {
44
34
}
45
35
```
46
-
5. Then use it like so:
36
+
5. If you want to adjust the theme at runtime, you can use `MaterialCssVarsService`:
47
37
```typescript
48
38
import {MaterialCssVarsService} from 'angular-material-css-vars';
49
39
@@ -90,36 +80,15 @@ There are also [some additional hacks](additional-hacks.md) (e.g. adding a color
90
80
You can provide different options before initialization to change the body class used for the dark theme and to provide different default styles:
91
81
```scss
92
82
...
93
-
@use 'angular-material-css-vars' as mat-css-vars;
94
-
...
95
-
96
-
@include mat-css-vars.init-material-css-vars(
97
-
// $default-light-theme: ... ;
98
-
// $text: ... ;
83
+
@use 'angular-material-css-vars' as mat-css-vars with (
99
84
$dark-theme-selector: '.isDarkTheme',
100
-
$light-theme-selector: '.isLightTheme',
85
+
$light-theme-selector: '.isLightTheme'
101
86
);
87
+
...
102
88
103
-
```
104
-
To make those variables take effect with your mixins, you need to make sure that they are also defined before using them. E.g.:
105
-
```scss
106
-
@use 'angular-material-css-vars' as mat-css-vars;
107
-
108
-
@include mat-css-vars.init-material-css-vars(
109
-
// probably best put in a common variables file and imported before the mixins
110
-
$dark-theme-selector: '.isDarkTheme',
111
-
);
89
+
@include mat-css-vars.init-material-css-vars();
112
90
113
-
.my-component {
114
-
@include mat-css-vars.mat-css-dark-theme {
115
-
// dark theme styles ...
116
-
}
117
-
}
118
91
```
119
-
120
-
121
-
A full list of the theme map [can be found here](https://github.com/johannesjo/angular-material-css-vars/blob/master/projects/material-css-vars/src/lib/_variables.scss).
122
-
123
92
124
93
### Set default (fallback palettes)
125
94
There are two ways to set the default fallback theme. One is using the `mat-css-palette-defaults` mixin.
@@ -133,14 +102,10 @@ There are two ways to set the default fallback theme. One is using the `mat-css-
The other is to include your own variables for [$mat-css-default-light-theme](https://github.com/johannesjo/angular-material-css-vars/blob/master/projects/material-css-vars/src/lib/_variables.scss).
105
+
The other is to include your own variables for [$default-light-theme](https://github.com/johannesjo/angular-material-css-vars/blob/master/projects/material-css-vars/src/lib/_variables.scss).
137
106
```scss
138
-
@use 'angular-material-css-vars' as mat-css-vars;
139
-
140
-
$mat-css-default-light-theme: map-merge(
141
-
// if you don't want to enter ALL the properties
142
-
mat-css-vars.$default-light-theme,
143
-
(
107
+
@use 'angular-material-css-vars' as mat-css-vars with (
0 commit comments