I cannot get the dark themes to work
See original GitHub issueI cannot find an open/closed issue with this but I found this: http://stackoverflow.com/questions/41967601/dark-theme-in-angular-material2-is-not-dark
For the contrast from white to dark to apply if you add a $theme: mat-dark-theme($primary, $accent);
in struction
Everything just stays on the light theme no matter which theme you choose or create.
If you @import '~@angular/material/core/theming/prebuilt/purple-green';
to app.component.scss (using the default CLI project)
or create your own:
@include mat-core();
$primary: mat-palette($mat-indigo,A400);
$accent: mat-palette($mat-lime,A400);
$warn: mat-palette($mat-red);
$test: mat-dark-theme($primary, $accent, $warn);
@include angular-material-theme($test);
The colours are available but none of the stylings under $mat-dark-theme-background
and $mat-dark-theme-foreground
work.
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Blackout: How to Enable Dark Mode on Your Browser | PCMag
Enable OS Dark Mode Here's how to do that on all your devices: Windows 10: Open Settings > Personalization > Colors and choose...
Read more >Browse in Dark mode or Dark theme - Google Chrome Help
When you browse in Dark mode or Dark theme in Chrome, your homepage, toolbar, settings, and some other pages will be dark. Important:...
Read more >2022 Fix: Youtube Dark Mode not working - How to enable it
Your browser can't play this video. Learn more. Switch camera.
Read more >Dark Mode Not Working in Windows 10—What to Do
Dark Mode Not Working in Windows 10—What to Do · Update Your Windows · Enable Dark Mode Again · Fix It in the...
Read more >How to Fix the Chrome Dark Mode Not Working Issue in ...
Disable Existing Themes ... Even after getting Chrome's dark mode to work, you may find it rendering unevenly within the theme. These graphical ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@kara, I see. It was a little bit jarring going from using
md-sidenav-container
and having the content region styled as expected, as seen here.In the theming guide, it says:
This leads you to believe that if you apply a dark theme, the foreground palette and background palette will provide an appropriately styled foreground and background.
I did, however, catch this (which was not in the theming guide the first time I read through it):
After reading this, I was able to get the results I wanted by adding
mat-app-background
to the root element in my app component, and a color styling instyles.scss
:app.component.html
styles.scss
It might be helpful to have a similar
mat-app-foreground
class that allows you to opt into styling the background / foreground based on the active theme.This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.