I am using latest version of angular and angular material. I followed the theme guide at https://material.angular.io/guide/theming. I am using one of the pre-build theme in my application but I am unable to change the application to dark mode.
my code looks like as follows.
app.component.html
ng-container [class.dark-theme]="isDark" class="mat-app-background">
<mat-sidenav-container>
<mat-sidenav></mat-sidenav>
<mat-sidenav-content>
<app-request></app-request>
<app-benchmark></app-benchmark>
</mat-sidenav-content>
</mat-sidenav-container>
</ng-container>
app.component.ts
export class AppComponent implements OnInit {
isDark = true;
ngOnInit(): void {
}
}
style.css
/* You can add global styles to this file, and also import other style files */
@import '~@angular/material/prebuilt-themes/indigo-pink.css';
html, body { height: 100%; }
body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; }
I can see my application using material, it just not applying dark mode. Am I missing something ?
encapsulation: ViewEncapsulation.None, so that you can override the style - Joel Joseph