Page 1 of 1

Detect Dark Mode

Posted: 09 Nov 2020, 20:24
by oscarreno
Hello everybody.

How can I detect when Dark Mode is selected so I can give my own components the correct looks?

Thank you!

Re: Detect Dark Mode

Posted: 11 Nov 2020, 09:50
by mert.sincan
Hi,

We can detect it using darkMode variable in app.main.component.ts in our sample project. I don't know the structure in your project, but if you have a switch-mode structure, the variable you use for that structure can help you.
Then, maybe you can add a class to app.main.component.html

Code: Select all

<div class="layout-wrapper" (click)="onLayoutClick()" [ngClass]="{'layout-dark': darkMode, ...}"
...
Best Regards,