Detect Dark Mode

Forum rules
Please note that response time for technical support is within 3-5 business days.
Post Reply
oscarreno
Posts: 1
Joined: 30 Mar 2020, 22:36

09 Nov 2020, 20:24

Hello everybody.

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

Thank you!

mert.sincan
Posts: 5281
Joined: 29 Jun 2013, 12:38

11 Nov 2020, 09:50

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,

Post Reply

Return to “Mirage - PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests