Reputation: 321
Why when I set a dark theme does the background itself remain white? Do I need to install css black background myself? Or can fix this somehow?
"styles": [
"node_modules/@angular/material/prebuilt-themes/purple-green.css",
"src/styles.scss"
],
Upvotes: 1
Views: 881
Reputation: 26750
This is because you need to add the mat-app-background
class to your document's body
element if you're not using a sidenav container, as documented in the guide for theming:
Finally, if your app's content is not placed inside of a
mat-sidenav-container
element, you need to add themat-app-background
class to your wrapper element (for example thebody
). This ensures that the proper theme background is applied to your page. - Theming your Angular Material app > Using a prebuilt theme
For example:
<body class="mat-app-background">
<app-root>Loading...</app-root>
</body>
<!-- ... -->
Upvotes: 2