Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 48977

Angular Ionic v-5 dark mode toggle

$
0
0

How can I make a toggle where the user can choose:

Light | Dark | Auto

where light or dark is the appearance of the PWA and ‘Auto’ follows system dark/light mode.

I have tried following the docs Dark Mode - Ionic Documentation but even doing document.body.classList.toggle('dark', false); on ngOnInit, or this.renderer.addClass(this.document.body, 'dark'); in a component does not work, thanks!

(My app.component.ts defaults styles to iOS using IonicModule.forRoot({ mode: 'ios' }),, not sure if this is of any relevance!)

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 48977

Trending Articles